build git image

This commit is contained in:
Ronmi Ren 2025-01-13 16:43:00 +08:00
commit e1319660d9
2 changed files with 66 additions and 1 deletions

View file

@ -9,7 +9,7 @@ on:
- 'v*' - 'v*'
jobs: jobs:
docker: basic:
runs-on: any runs-on: any
steps: steps:
- name: Checkout code - name: Checkout code
@ -66,3 +66,55 @@ jobs:
password: ${{ secrets.DOCKER_HUB_PASSWORD }} password: ${{ secrets.DOCKER_HUB_PASSWORD }}
repository: ronmi/forgejo-pages repository: ronmi/forgejo-pages
with-git:
runs-on: any
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up qemu for buildx
uses: docker/setup-qemu-action@v3
- name: Setup buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Docker - login to my git
uses: docker/login-action@v3
with:
registry: git.ronmi.tw
username: ronmi
password: ${{ secrets.PACKAGE_PUSH_KEY }}
- name: Docker - login to hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Build arm64 binary
run: GOARCH=arm64 go build
- name: Build arm64 image
uses: docker/build-push-action@v6
with:
context: .
file: git.dockerfile
platforms: linux/arm64
push: true
pull: true
tags: git.ronmi.tw/ronmi/forgejo-pages:git-arm64,ronmi/forgejo-pages:git-arm64
- name: Build amd64 binary
run: GOARCH=amd64 go build
- name: Build amd64 image
uses: docker/build-push-action@v6
with:
context: .
file: git.dockerfile
platforms: linux/amd64
push: true
pull: true
tags: git.ronmi.tw/ronmi/forgejo-pages:git-amd64,ronmi/forgejo-pages:git-amd64
- name: Create multiarch image
run: |
docker buildx imagetools create -t git.ronmi.tw/ronmi/forgejo-pages:git git.ronmi.tw/ronmi/forgejo-pages:git-arm64 git.ronmi.tw/ronmi/forgejo-pages:git-amd64
docker buildx imagetools create -t ronmi/forgejo-pages:git ronmi/forgejo-pages:git-arm64 ronmi/forgejo-pages:git-amd64

13
git.dockerfile Normal file
View file

@ -0,0 +1,13 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
FROM debian:stable-slim
# Install git
RUN apt-get update && apt-get install -y \
ca-certificates git \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
ADD forgejo-pages /usr/bin/forgejo-pages
ENTRYPOINT ["/usr/bin/forgejo-pages"]