Files
prezentacija-dockeriziranje/api-server/Dockerfile
2024-01-10 16:46:17 +01:00

21 lines
380 B
Docker

FROM golang:1.21-alpine
# disable crosscompiling
ENV CGO_ENABLED=0
# compile linux only
ENV GOOS=linux
WORKDIR /app
COPY ./app .
# fetch go libs and build the binary with debug information removed
RUN \
go mod download && \
go mod verify && \
go build -v -ldflags "-s -w" -a -installsuffix cgo -o api-server ./main.go
WORKDIR /app
ENTRYPOINT ["/app/api-server"]