This commit is contained in:
@@ -6,35 +6,38 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build docker:
|
# No space in the job id: it is interpolated verbatim into the podman network
|
||||||
runs-on: linux_amd
|
# name, and podman rejects [a-zA-Z0-9][a-zA-Z0-9_.-]* violations that docker let through.
|
||||||
|
build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
IMAGE: git.d3vyce.fr/${{ github.repository }}:latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v7
|
||||||
|
# actions/checkout#1830
|
||||||
# with:
|
# with:
|
||||||
# lfs: 'true'
|
# lfs: 'true'
|
||||||
- name: Checkout LFS
|
- name: Checkout LFS
|
||||||
run: |
|
run: |
|
||||||
function EscapeForwardSlash() { echo "$1" | sed 's/\//\\\//g'; }
|
function EscapeForwardSlash() { echo "$1" | sed 's/\//\\\//g'; }
|
||||||
readonly ReplaceStr="EscapeForwardSlash ${{ gitea.repository }}.git/info/lfs/objects/batch"; sed -i "s/\(\[http\)\( \".*\)\"\]/\1\2`$ReplaceStr`\"]/" .git/config
|
readonly ReplaceStr="EscapeForwardSlash ${{ gitea.repository }}.git/info/lfs/objects/batch"; sed -i "s/\(\[http\)\( \".*\)\"\]/\1\2`$ReplaceStr`\"]/" .git/config
|
||||||
git config --local lfs.transfer.maxretries 1
|
|
||||||
/usr/bin/git lfs fetch origin refs/remotes/origin/${{ gitea.ref_name }}
|
/usr/bin/git lfs fetch origin refs/remotes/origin/${{ gitea.ref_name }}
|
||||||
/usr/bin/git lfs checkout
|
/usr/bin/git lfs checkout
|
||||||
- name: Set up QEMU
|
- name: Verify LFS objects resolved
|
||||||
uses: docker/setup-qemu-action@v3
|
run: |
|
||||||
- name: Set up Docker Buildx
|
# A failed fetch leaves pointer files behind and hugo only dies later on
|
||||||
uses: docker/setup-buildx-action@v3
|
# .Resize with "image: unknown format". Fail here, where the cause is legible.
|
||||||
- name: Login to Docker registry
|
if git lfs ls-files | awk '$2 == "-"' | grep -q .; then
|
||||||
uses: docker/login-action@v3
|
echo "::error::LFS objects missing - these are still pointer files:"
|
||||||
with:
|
git lfs ls-files | awk '$2 == "-" { print " " $3 }'
|
||||||
registry: git.d3vyce.fr
|
exit 1
|
||||||
username: ${{ github.actor }}
|
fi
|
||||||
password: ${{ secrets.GIT_TOKEN }}
|
- name: Install buildah
|
||||||
|
run: |
|
||||||
|
apt-get update && apt-get install -y buildah
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
run: |
|
||||||
with:
|
buildah login -u "${{ github.actor }}" -p "${{ secrets.GIT_TOKEN }}" git.d3vyce.fr
|
||||||
context: .
|
buildah --storage-driver vfs build --isolation chroot -t "$IMAGE" -f ./Dockerfile .
|
||||||
file: ./Dockerfile
|
buildah --storage-driver vfs push "$IMAGE"
|
||||||
platforms: linux/amd64
|
|
||||||
push: true
|
|
||||||
tags: git.d3vyce.fr/${{ github.repository }}:latest
|
|
||||||
|
|||||||
+3
-5
@@ -1,17 +1,15 @@
|
|||||||
# Build Stage
|
# Build Stage
|
||||||
FROM hugomods/hugo:0.161.1 AS build
|
FROM docker.io/hugomods/hugo:0.164.0 AS build
|
||||||
|
|
||||||
ARG BLOWFISH_VERSION
|
|
||||||
|
|
||||||
WORKDIR /opt/blog
|
WORKDIR /opt/blog
|
||||||
COPY . /opt/blog/
|
COPY . /opt/blog/
|
||||||
|
|
||||||
RUN git submodule update --init --recursive && \
|
RUN git submodule update --init --recursive && \
|
||||||
git -C themes/blowfish/ checkout v2.103.0
|
git -C themes/blowfish/ checkout v2.105.0
|
||||||
RUN hugo
|
RUN hugo
|
||||||
|
|
||||||
# Publish Stage
|
# Publish Stage
|
||||||
FROM nginx:1.31-alpine
|
FROM docker.io/nginx:1.31-alpine
|
||||||
|
|
||||||
WORKDIR /usr/share/nginx/html
|
WORKDIR /usr/share/nginx/html
|
||||||
COPY --from=build /opt/blog/public /usr/share/nginx/html/
|
COPY --from=build /opt/blog/public /usr/share/nginx/html/
|
||||||
|
|||||||
Reference in New Issue
Block a user