21 lines
380 B
Docker
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"]
|