Dockerize

This commit is contained in:
SuperMarioDaBom 2023-07-16 21:25:43 -07:00
parent a817a7ccd0
commit 56f4381eb9
2 changed files with 26 additions and 0 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
.env
.git
build
log
go.work
*.test
go.work.sum

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
# --- builder ---
FROM golang:1.20.6-alpine3.17 as builder
LABEL stage=builder
RUN apk add git
WORKDIR /build
COPY go.* ./
RUN go mod download
COPY . ./
ARG BUILD_STRING=pretendo.friends.docker
RUN go build -ldflags "-X 'main.serverBuildString=${BUILD_STRING}'" -v -o server
# --- runner ---
FROM alpine:3.17 as runner
WORKDIR /build
COPY --from=builder /build/server /build/
CMD ["/build/server"]