Golang api server

This commit is contained in:
Eden Kirin
2024-01-10 16:46:17 +01:00
commit 3d3dbd19f0
6 changed files with 238 additions and 0 deletions

20
api-server/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
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"]