diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c6e5015 --- /dev/null +++ b/.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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3ffd8e1 --- /dev/null +++ b/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" ]