Browse Source

Add Dockerfile

master
Kenneth Bruen 9 months ago
parent
commit
938edab3d6
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 25
      .dockerignore
  2. 24
      Dockerfile

25
.dockerignore

@ -0,0 +1,25 @@
### Go template
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
# Also ignore the Dockerfile
Dockerfile

24
Dockerfile

@ -0,0 +1,24 @@
FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS build
LABEL authors="kbruen"
LABEL org.opencontainers.image.source=https://github.com/dancojocaru2000/CfrTrainInfoTelegramBot
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY main.go ./
COPY pkg ./pkg/
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o server
FROM scratch
COPY --from=build /etc/ssl/certs /etc/ssl/certs
WORKDIR /app
# COPY static ./static/
COPY --from=build /app/server ./
ENV DEBUG=false
ENTRYPOINT [ "/app/server" ]
Loading…
Cancel
Save