-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from golang base image to alpine
No need to have the go development tools in our run-time image. Signed-off-by: Toby Cabot <toby@acnodal.io>
- Loading branch information
Showing
2 changed files
with
8 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,20 @@ | ||
FROM golang:1.17-alpine as builder | ||
FROM golang:1.17.13-alpine as builder | ||
|
||
ENV GOOS=linux | ||
|
||
WORKDIR /opt/acnodal/src | ||
WORKDIR /opt/epic-gateway/src | ||
COPY . ./ | ||
|
||
# build the web service (static) | ||
# build the executable (static) | ||
RUN go build -tags 'osusergo netgo' -o ../bin/web-service main.go | ||
|
||
|
||
# start fresh | ||
FROM golang:1.17-alpine | ||
ENV bin=/opt/acnodal/bin/web-service | ||
FROM alpine:3.16.7 | ||
|
||
# copy executables from the builder image | ||
# copy executable from the builder image | ||
ENV bin=/opt/epic-gateway/bin/web-service | ||
COPY --from=builder ${bin} ${bin} | ||
|
||
EXPOSE 8080 | ||
|
||
# The softlink is because Dockerfile variable interpolation happens at | ||
# run-time so if you have variables in the CMD string they won't get | ||
# resolved to their values. This lets us have a hard-coded CMD string | ||
# that links to the image-specific command. | ||
RUN ln -s ${bin} /opt/acnodal/bin/cmd | ||
CMD ["/opt/acnodal/bin/cmd"] | ||
CMD ["/opt/epic-gateway/bin/web-service"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters