add frontend docker

This commit is contained in:
Jonas Leder 2026-05-17 13:20:48 +02:00
commit aa21296df4
3 changed files with 39 additions and 14 deletions

View file

@ -36,20 +36,20 @@ BackendDocker:
- image-hash-backend.txt
- backend.bom.json
# FrontendDocker:
# image: jonasled.dev/infra/docker-build:master@sha256:487a62177b7dad5dbd59ee60ef0ea74b6353eb093f80e9e28a6635d2ee053e5c
# stage: build
# needs: []
# script:
# - export IMAGE_NAME=$CI_REGISTRY_IMAGE/frontend
# - export BUILDKIT_ADDITIONAL_ARGS="--opt filename=Dockerfile.frontend"
# - build-image
# - mv image-hash.txt image-hash-frontend.txt
# - mv image-scan-report.bom.json frontend.bom.json
# artifacts:
# paths:
# - image-hash-frontend.txt
# - frontend.bom.json
FrontendDocker:
image: jonasled.dev/infra/docker-build:master@sha256:487a62177b7dad5dbd59ee60ef0ea74b6353eb093f80e9e28a6635d2ee053e5c
stage: build
needs: []
script:
- export IMAGE_NAME=$CI_REGISTRY_IMAGE/frontend
- export BUILDKIT_ADDITIONAL_ARGS="--opt filename=Dockerfile.frontend"
- build-image
- mv image-hash.txt image-hash-frontend.txt
- mv image-scan-report.bom.json frontend.bom.json
artifacts:
paths:
- image-hash-frontend.txt
- frontend.bom.json
# Helm:
# stage: bundle

10
Dockerfile.frontend Normal file
View file

@ -0,0 +1,10 @@
FROM --platform=$BUILDPLATFORM node:24.15-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f AS build
WORKDIR /app
COPY ./frontend ./
RUN yarn install --immutable && \
yarn build
FROM cgr.dev/chainguard/nginx@sha256:b66791d04723935f4c3fa436bc6c445eecece8b5136490b7dc976b4555d74fa9
WORKDIR /usr/share/nginx/html
COPY --from=build /app/dist/ .
COPY container/nginx.conf /etc/nginx/conf.d/nginx.default.conf

15
container/nginx.conf Normal file
View file

@ -0,0 +1,15 @@
server {
listen 8080;
server_name localhost;
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; frame-ancestors 'none'; object-src 'none'; img-src 'self' data: blob:; font-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'self'; manifest-src 'self'; worker-src 'self' blob:; media-src 'self' blob:;" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header X-XSS-Protection "1; mode=block" always;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}