Skip to content

Commit c0b3dae

Browse files
authored
Merge pull request #2 from WISVCH/docker-workflow
Added docker workflow
2 parents 1a0b658 + 07ccca2 commit c0b3dae

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/workflows/docker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Docker
2+
on:
3+
push:
4+
schedule:
5+
- cron: "42 2 2 * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
buildDockerImage:
10+
name: Build Docker image
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
lfs: false
18+
- name: Create LFS file list
19+
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
20+
- name: LFS Cache
21+
uses: actions/cache@v4
22+
with:
23+
path: .git/lfs/objects
24+
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
25+
restore-keys: |
26+
${{ runner.os }}-lfs-
27+
- name: Git LFS Pull
28+
run: git lfs pull
29+
- name: Setup Hugo
30+
uses: peaceiris/actions-hugo@v2
31+
with:
32+
hugo-version: 'latest'
33+
extended: true
34+
- name: Build
35+
run: hugo --minify --noTimes=false
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v1
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@v1
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
- name: Docker meta
45+
id: meta
46+
uses: docker/metadata-action@v3
47+
with:
48+
images: ghcr.io/wisvch/bapc-2025
49+
tags: type=sha, prefix={{date 'YYYYMMDD'}}-
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@v2
52+
with:
53+
context: .
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
push: ${{ github.ref == 'refs/heads/main' }}

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM wisvch/nginx
2+
# Change the config file to serve index for urls
3+
USER root
4+
RUN sed -i -r '/404.html;/a\ error_page 404 /404.html;' /etc/nginx/conf.d/default.conf
5+
RUN sed -i -r '/^server \{.*/a absolute_redirect off;' /etc/nginx/conf.d/default.conf
6+
USER 100
7+
COPY --link ./public /srv

0 commit comments

Comments
 (0)