You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: golang/README.md
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -118,20 +118,23 @@ Go (a.k.a., Golang) is a programming language first developed at Google. It is a
118
118
119
119
# How to use this image
120
120
121
-
**Note:**`/go` is world-writable to allow flexibility in the user which runs the container (for example, in a container started with `--user 1000:1000`, running `go get github.com/example/...` will succeed). While the `777` directory would be insecure on a regular host setup, there are not typically other processes or users inside the container, so this is equivilant to `700` for Docker usage, but allowing for `--user` flexibility.
121
+
**Note:**`/go` is world-writable to allow flexibility in the user which runs the container (for example, in a container started with `--user 1000:1000`, running `go get github.com/example/...`into the default `$GOPATH`will succeed). While the `777` directory would be insecure on a regular host setup, there are not typically other processes or users inside the container, so this is equivalent to `700` for Docker usage, but allowing for `--user` flexibility.
122
122
123
123
## Start a Go instance in your app
124
124
125
-
The most straightforward way to use this image is to use a Go container as both the build and runtime environment. In your `Dockerfile`, writing something along the lines of the following will compile and run your project:
125
+
The most straightforward way to use this image is to use a Go container as both the build and runtime environment. In your `Dockerfile`, writing something along the lines of the following will compile and run your project (assuming it uses `go.mod` for dependency management):
126
126
127
127
```dockerfile
128
128
FROM golang:1.17
129
129
130
-
WORKDIR /go/src/app
131
-
COPY . .
130
+
WORKDIR /usr/src/app
131
+
132
+
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
0 commit comments