Skip to content

Commit abeca50

Browse files
committed
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>
1 parent 1af379b commit abeca50

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

Dockerfile

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
FROM golang:1.17-alpine as builder
1+
FROM golang:1.17.13-alpine as builder
22

33
ENV GOOS=linux
4-
5-
WORKDIR /opt/acnodal/src
4+
WORKDIR /opt/epic-gateway/src
65
COPY . ./
76

8-
# build the web service (static)
7+
# build the executable (static)
98
RUN go build -tags 'osusergo netgo' -o ../bin/web-service main.go
109

1110

1211
# start fresh
13-
FROM golang:1.17-alpine
14-
ENV bin=/opt/acnodal/bin/web-service
12+
FROM alpine:3.16.7
1513

16-
# copy executables from the builder image
14+
# copy executable from the builder image
15+
ENV bin=/opt/epic-gateway/bin/web-service
1716
COPY --from=builder ${bin} ${bin}
1817

1918
EXPOSE 8080
2019

21-
# The softlink is because Dockerfile variable interpolation happens at
22-
# run-time so if you have variables in the CMD string they won't get
23-
# resolved to their values. This lets us have a hard-coded CMD string
24-
# that links to the image-specific command.
25-
RUN ln -s ${bin} /opt/acnodal/bin/cmd
26-
CMD ["/opt/acnodal/bin/cmd"]
20+
CMD ["/opt/epic-gateway/bin/web-service"]

0 commit comments

Comments
 (0)