fix: GitHub Actions: use podman instead

This commit is contained in:
Paul Pan 2024-02-19 17:07:06 +08:00
parent a193dee410
commit 1ba08698c2
Signed by: Paul
GPG Key ID: D639BDF5BA578AF4
3 changed files with 24 additions and 11 deletions

View File

@ -1,12 +1,25 @@
name: Build Docker Image
name: Build Container Image
on: [ push ]
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# reference: https://github.com/containers/podman/discussions/17868
- name: Tar as root
run: |
sudo mv -fv /usr/bin/tar /usr/bin/tar.orig
echo -e '#!/bin/sh\n\nsudo /usr/bin/tar.orig "$@"' | sudo tee -a /usr/bin/tar
sudo chmod +x /usr/bin/tar
- name: Cache Podman
uses: actions/cache@v4
with:
path: |
~/.local/share/containers
~/.config/containers
key: ${{ runner.os }}-${{ hashFiles('**/*.Dockerfile', 'build_image.sh', 'VERSION', 'go.*') }}
- name: Login to Container Registry
uses: docker/login-action@v3
uses: redhat-actions/podman-login@v1
with:
registry: git.0x7f.app
username: ${{ secrets.CONTAINER_USERNAME }}
@ -19,12 +32,12 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: ./build_image.sh base
env:
DOCKER: docker
DOCKER: podman
- name: Build Server Image
run: ./build_image.sh server
env:
DOCKER: docker
DOCKER: podman
- name: Build Runner Image
run: ./build_image.sh runner
env:
DOCKER: docker
DOCKER: podman

View File

@ -6,7 +6,7 @@ ENV CGO_ENABLED=0
WORKDIR /builder
RUN apk add --no-cache git make
RUN --mount=type=cache,id=golang,target=/go/pkg go install github.com/swaggo/swag/cmd/swag@latest
RUN go install github.com/swaggo/swag/cmd/swag@latest
ARG IMAGE_PREFIX=git.0x7f.app/woj
ENV CONTAINER_IMAGE_FULL=${IMAGE_PREFIX}/ubuntu-full:latest
@ -14,10 +14,10 @@ ENV CONTAINER_IMAGE_RUN=${IMAGE_PREFIX}/ubuntu-run:latest
COPY go.mod /builder/go.mod
COPY go.sum /builder/go.sum
RUN --mount=type=cache,id=golang,target=/go/pkg go mod download
RUN go mod download
COPY . /builder
RUN --mount=type=cache,id=golang,target=/go/pkg make build
RUN make build
# main image

View File

@ -6,14 +6,14 @@ ENV CGO_ENABLED=0
WORKDIR /builder
RUN apk add --no-cache git make
RUN --mount=type=cache,id=golang,target=/go/pkg go install github.com/swaggo/swag/cmd/swag@latest
RUN go install github.com/swaggo/swag/cmd/swag@latest
COPY go.mod /builder/go.mod
COPY go.sum /builder/go.sum
RUN --mount=type=cache,id=golang,target=/go/pkg go mod download
RUN go mod download
COPY . /builder
RUN --mount=type=cache,id=golang,target=/go/pkg make build
RUN make build
# UI Builder
FROM git.0x7f.app/woj/woj-ui:1.1.0 AS ui-builder