From a5aec1fca3e2d4050e1e3ac300c49f3d7ebf09af Mon Sep 17 00:00:00 2001 From: nquidox Date: Sun, 5 Apr 2026 20:16:44 +0300 Subject: [PATCH] build files --- .forgejo/workflows/make-image.yml | 2 ++ Dockerfile | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/.forgejo/workflows/make-image.yml b/.forgejo/workflows/make-image.yml index 392037e..087e050 100644 --- a/.forgejo/workflows/make-image.yml +++ b/.forgejo/workflows/make-image.yml @@ -33,8 +33,10 @@ jobs: echo "VERSION=${VERSION}" >> $GITHUB_ENV - name: Make image + GIT_CREDENTIALS: https://${{ secrets.MAINTAINER_USERNAME }}:${{ secrets.MAINTAINER_TOKEN }}@repo.nqws.ru/ run: | docker buildx build --platform linux/amd64 \ + --secret id=git_creds,env=GIT_CREDENTIALS \ --tag repo.nqws.ru/${{ github.repository }}:latest \ --tag repo.nqws.ru/${{ github.repository }}:${{ env.VERSION }} \ --push . diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c8fe906 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM golang:1.26.1-alpine3.23 AS builder + +RUN apk add --no-cache git + +ENV GOPRIVATE=repo.nqws.ru/* +ENV GONOSUMDB=repo.nqws.ru/* + +WORKDIR /app + +COPY go.mod go.sum ./ + +RUN --mount=type=secret,id=netrc,dst=/root/.netrc,mode=0600 \ + git config --global credential.helper 'store --file=/root/.netrc' && \ + go mod download + +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o main "./cmd" + + +FROM alpine:3.23 + +RUN apk add --no-cache \ + tzdata \ + ca-certificates + +COPY --from=builder /app/main /usr/local/bin/app + + +RUN chmod +x /usr/local/bin/app + +ENTRYPOINT ["app"]