This commit is contained in:
parent
099b03a862
commit
7fbc196c84
2 changed files with 61 additions and 0 deletions
40
.forgejo/workflows/make-image.yml
Normal file
40
.forgejo/workflows/make-image.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v[0-9]+*'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: nqws-auth-app
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
name: Make image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Forgejo
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: repo.nqws.ru
|
||||||
|
username: ${{ secrets.MAINTAINER_USERNAME }}
|
||||||
|
password: ${{ secrets.MAINTAINER_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract version from tag
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
|
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Make image
|
||||||
|
run: |
|
||||||
|
docker buildx build --platform linux/amd64 \
|
||||||
|
--tag repo.nqws.ru/${{ github.repository }}:latest \
|
||||||
|
--tag repo.nqws.ru/${{ github.repository }}:${{ env.VERSION }} \
|
||||||
|
--push .
|
||||||
21
Dockerfile
Normal file
21
Dockerfile
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
FROM golang:1.26.1-alpine3.23 AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN 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"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue