Skip to content

Commit 9b26ffe

Browse files
committed
container image build workflow
1 parent 228bded commit 9b26ffe

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Container Image Build and Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
packages: write
9+
10+
concurrency:
11+
group: build-${{ github.ref }}
12+
cancel-in-progress: false
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}
17+
18+
jobs:
19+
build:
20+
name: Build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
token: ${{ secrets.BOT_PAT }}
27+
submodules: recursive
28+
29+
- name: Log in to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=ref,event=branch
43+
type=sha,prefix=
44+
type=raw,value=latest,enable={{is_default_branch}}
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG GOLANG_VERSION=1.23
3+
ARG GOLANG_VERSION=1.24
44
ARG ALPINE_VERSION=3.20
55
ARG NODE_VERSION=22
66

@@ -13,6 +13,8 @@ RUN ./generate_golang_routes.sh
1313

1414
FROM docker.io/library/golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS basebuilder
1515

16+
ENV GOTOOLCHAIN=auto
17+
1618
WORKDIR /backend
1719

1820
RUN apk add --no-cache gcc musl-dev
@@ -37,4 +39,4 @@ WORKDIR /backend
3739
COPY --from=builder /backend/backend /usr/local/bin/backend
3840
COPY --from=builder /backend/server/routes.json /backend/routes.json
3941

40-
CMD ["backend", "-b", "0.0.0.0", "-p", "1984", "-db-backend", "postgres", "-db-path", "postgresql://postgres:dbpass@db:5432/dbname"]
42+
CMD ["backend"]

0 commit comments

Comments
 (0)