Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker image to specific Golang version #107

Merged
merged 1 commit into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.13.0
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:latest
ARG GO_VERSION
FROM golang:${GO_VERSION:-1.13.0}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to force the version to come from an outside arg you could do

ARG GO_VERSION
FROM golang:${GO_VERSION}

and run docker build --build-arg GO_VERSION=$(cat .go_version) .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, missed the ARG line. That was exactly what I wanted to do.


RUN \
apt-get update \
Expand All @@ -20,5 +21,6 @@ RUN mage build
# If we keep it, it means all packages exist twice.
RUN rm -rf dev

ENTRYPOINT ["go", "run", "."]
# Make sure it's accessible from outside the container
ENTRYPOINT ["go", "run", ".", "--address=0.0.0.0:8080"]
CMD ["--address=0.0.0.0:8080"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ There are several options to run this.

### Go command

To use the correct golang version, run:

```
gvm use $(cat .go-version)
```

When using the go command, first the example packages must be built:

`mage build`
Expand Down