From cdd9dce20a8da4cde6aff263ddcfdccea9b2a6ee Mon Sep 17 00:00:00 2001 From: Verwoerd Date: Sat, 2 Nov 2024 07:28:23 +0100 Subject: [PATCH] Fix build --- .github/workflows/docker.yml | 36 +++++++++++++++++++++++++++--------- Dockerfile | 7 +------ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4f63a80..90cd658 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,34 +5,52 @@ on: - cron: "42 2 2 * *" workflow_dispatch: -env: - REGISTRY: ghcr.io - REPO_NAME: ${{ github.repository }} - jobs: buildDockerImage: name: Build Docker image runs-on: ubuntu-latest steps: - name: Checkout code - uses: nschloe/action-cached-lfs-checkout@v1 + uses: actions/checkout@v4 with: submodules: recursive + lfs: false + - name: Create LFS file list + run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id + - name: LFS Cache + uses: actions/cache@v4 + with: + path: .git/lfs/objects + key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} + restore-keys: | + ${{ runner.os }}-lfs- + - name: Git LFS Pull + run: git lfs pull + # remove the git lfs directory to free up disk space + - name: Remove File + uses: JesseTG/rm@v1.0.3 + with: + path: ./git/lfs + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.135.0' + extended: true + - name: Build + run: hugo --minify --noTimes=false - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: - registry: ${{ env.REGISTRY }} + registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Repo name - run: echo "IMAGE_ID=$(echo ${{ env.REGISTRY }}/${{ env.REPO_NAME }} | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV - name: Docker meta id: meta uses: docker/metadata-action@v3 with: - images: "${{ env.IMAGE_ID }}" + images: ghcr.io/wisvch/nwerc-2024 tags: type=sha, prefix={{date 'YYYYMMDD'}}- - name: Build and push Docker image uses: docker/build-push-action@v2 diff --git a/Dockerfile b/Dockerfile index 8cd6551..d80b8ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,7 @@ -FROM klakegg/hugo:ext AS builder -ENV HUGO_ENV=production -COPY . /src -RUN hugo - FROM wisvch/nginx # Change the config file to serve index for urls USER root RUN sed -i -r '/404.html;/a\ error_page 404 /404.html;' /etc/nginx/conf.d/default.conf RUN sed -i -r '/^server \{.*/a absolute_redirect off;' /etc/nginx/conf.d/default.conf USER 100 -COPY --from=builder /src/public/ /srv/ +COPY --link ./public /srv