-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |