Add dockerfile and build action
All checks were successful
Build / build (push) Successful in 38s

This commit is contained in:
Romein van Buren 2025-01-18 10:31:13 +01:00
parent 09f5c58829
commit 60f7fe858b
No known key found for this signature in database
5 changed files with 85 additions and 7 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
.vitepress/cache
.git
.DS_Store

31
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Build
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: code.smartyellow.net
username: ${{ github.actor }}
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Build
run: |
docker build . -t code.smartyellow.net/romein/hpg-site
- name: Push
run: |
docker push code.smartyellow.net/romein/hpg-site

View File

@ -64,13 +64,7 @@ export default defineConfig({
text: 'Deze pagina is open source!',
},
lastUpdated: {
text: 'Laatste aanpassing',
formatOptions: {
dateStyle: 'long',
timeStyle: 'short',
},
},
lastUpdated: false,
docFooter: {
prev: 'Vorige',

13
dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM node:16-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html
COPY --from=build /app/content/.vitepress/dist .
ENTRYPOINT ["nginx", "-g", "daemon off;"]

36
nginx.conf Normal file
View File

@ -0,0 +1,36 @@
server {
location / {
root /usr/share/nginx/html;
index index.html index.htm;
add_header Cache-Control "public, max-age=0";
try_files $uri $uri.html $uri/index.html $uri/index.htm $uri/ /index.html /index.htm =404;
}
location ^~ /immutable/ {
root /usr/share/nginx/html;
expires 1y;
}
location ^~ /bijlagen/ {
root /usr/share/nginx/html;
expires 1y;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
try_files $uri @redirect_to_index;
internal;
}
error_page 404 = @handle_404;
location @handle_404 {
root /usr/share/nginx/html;
try_files /404.html @redirect_to_index;
internal;
}
location @redirect_to_index {
return 302 /;
}
}