mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
Added Docker sub-section to Proxy section in Walkthrough (#650)
* added Docker sub-section * Added docker subsection Corrected the typos and, for this PR, the subsection is located before the `Using the proxy` section, it is more streamlined. * Docker intro updated As suggested by @robjloranger, the intro of the docker section has been updated to make it more simple to read.
This commit is contained in:
committed by
Michal Pristas
parent
73db12a433
commit
73a20132df
@@ -86,9 +86,41 @@ the proxy is using in-memory storage, which is only suitable for trying out the
|
||||
for a short period of time, as you will quickly run out of memory and the storage
|
||||
doesn't persist between restarts.
|
||||
|
||||
### With Docker
|
||||
In order to run the Athens Proxy using docker, we need first to create a directory that will store the persitant modules.
|
||||
In the example below, the new directory is named `athens-storage` and is located in our userspace (i.e. `$HOME`).
|
||||
Then we need to set the `ATHENS_STORAGE_TYPE` and `ATHENS_DISK_STORAGE_ROOT` environment variables when we run the Docker container.
|
||||
|
||||
**Bash**
|
||||
```bash
|
||||
export ATHENS_STORAGE=$HOME/athens-storage
|
||||
mkdir -p $ATHENS_STORAGE
|
||||
docker run -d -v $ATHENS_STORAGE:/var/lib/athens \
|
||||
-e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens \
|
||||
-e ATHENS_STORAGE_TYPE=disk \
|
||||
--name athens-proxy \
|
||||
--restart always \
|
||||
-p 3000:3000 \
|
||||
gomods/proxy:latest
|
||||
```
|
||||
|
||||
**PowerShell**
|
||||
```PowerShell
|
||||
$env:ATHENS_STORAGE = "$(Join-Path $HOME athens-storage)"
|
||||
md -Path $env:ATHENS_STORAGE
|
||||
docker run -d -v "$($env:ATHENS-STORAGE):/var/lib/athens" `
|
||||
-e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens `
|
||||
-e ATHENS_STORAGE_TYPE=disk `
|
||||
--name athens-proxy `
|
||||
--restart always `
|
||||
-p 3000:3000 `
|
||||
gomods/proxy:latest
|
||||
```
|
||||
|
||||
Next, you will need to enable the [Go Modules](https://github.com/golang/go/wiki/Modules)
|
||||
feature and configure Go to use the proxy!
|
||||
|
||||
### Using the proxy
|
||||
**Bash**
|
||||
```bash
|
||||
export GO111MODULE=on
|
||||
|
||||
Reference in New Issue
Block a user