Golang api server
This commit is contained in:
20
api-server/Dockerfile
Normal file
20
api-server/Dockerfile
Normal 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"]
|
||||
Reference in New Issue
Block a user