-
Notifications
You must be signed in to change notification settings - Fork 0
WIP: dockerization #16
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
FROM golang:alpine3.11 | ||
FROM golang:alpine3.11 as base | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
|
||
ENV CGO_ENABLED=0 | ||
RUN go build -o bin/naveed | ||
CMD ["/app/bin/naveed"] | ||
|
||
FROM busybox | ||
|
||
COPY --from=base /app/bin/naveed /usr/bin/naveed | ||
COPY --from=base /app/naveed.ini / | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this works because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct |
||
|
||
EXPOSE 8465/tcp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah .. you can remove it as well. For docker images it would be more explicit when the port (and the listening address) could be passed as options or env vars |
||
USER nobody | ||
CMD ["/usr/bin/naveed"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,8 @@ NB: | |
|
||
* run: | ||
|
||
$ docker run -it --rm --name naveed -p8080:8465 | ||
-v "$(pwd)/config:/app/config" \ | ||
$ docker run --rm --name naveed -p8080:8465 | ||
-v "$(pwd)/config:/" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup ... this adjustment was just made to keep it consistent with the prior image (as I moved the default config file to |
||
-e NAVEED_USERS_URL=… \ | ||
-e NAVEED_USERS_USERNAME=… \ | ||
-e NAVEED_USERS_PASSWORD=… \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# * relative paths originate from the application's working directory | ||
# * changes require restarting the server | ||
|
||
host = "localhost" | ||
host = "0.0.0.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure we want this to be the default though? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mmm ... ok: your choice. For production localhost doesn't make sense unless this runs on a host that contains a reverse proxy |
||
port = 8465 | ||
path-prefix = "/naveed" | ||
external-root = "https://example.org/naveed/" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a "multistage" Docker image: its as if you have a two docker files in one but you can access the first docker image. I build the binary in t he
golang:alpine
image (which contains the go compiler, etc.) and copy the result in a new image that is based onbusybox
, a minimal Linux Distro. This way, the resulting image is much smaller (384mb vs. 12mb)