Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
verwoerd committed Nov 2, 2024
1 parent 543bc7f commit cdd9dce
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
36 changes: 27 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
Expand Down
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cdd9dce

Please sign in to comment.