Allow esbuild build script for pnpm, fix frontend Dockerfile
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5de35abd98
commit
e6650f3f60
5 changed files with 59 additions and 0 deletions
4
.dockerignore
Normal file
4
.dockerignore
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
frontend/node_modules
|
||||
frontend/dist
|
||||
backend/*.db
|
||||
backend/.env
|
||||
15
Dockerfile.backend
Normal file
15
Dockerfile.backend
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.10.0 AS xx
|
||||
FROM --platform=$BUILDPLATFORM golang:1.27.4-alpine AS build
|
||||
ARG TARGETPLATFORM
|
||||
ARG GOPROXY
|
||||
COPY --from=xx / /
|
||||
WORKDIR /app
|
||||
COPY backend/go.mod backend/go.sum ./
|
||||
RUN go mod download
|
||||
COPY ./backend/ ./
|
||||
RUN CGO_ENABLED=0 GOOS=linux xx-go build -ldflags "-w -s" -o /pager .
|
||||
|
||||
FROM jonasled.dev/infra/images/scratch-rootless:latest@sha256:9e291c85277e40987bdbc84af228b4b40db5c24e1634d047465e2198ed9302e8
|
||||
ENV GIN_MODE=release
|
||||
COPY --from=build /pager /pager
|
||||
ENTRYPOINT ["/pager"]
|
||||
15
Dockerfile.frontend
Normal file
15
Dockerfile.frontend
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
FROM --platform=$BUILDPLATFORM node:24.22-alpine AS build
|
||||
WORKDIR /app
|
||||
RUN npx get-pnpm
|
||||
ENV PNPM_HOME='/root/.local/share/pnpm'
|
||||
ENV PATH="$PNPM_HOME/bin:$PATH"
|
||||
COPY ./frontend/package.json ./frontend/pnpm-lock.yaml ./frontend/pnpm-workspace.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY ./frontend ./
|
||||
RUN pnpm build
|
||||
|
||||
FROM cgr.dev/chainguard/nginx:latest@sha256:4ba9811960f4a9c987a9cea0d445fbff98bd28164d5f7ccc465558d1b7225213
|
||||
ARG NGINX_CONF=nginx.conf
|
||||
WORKDIR /usr/share/nginx/html
|
||||
COPY --from=build /app/dist/ .
|
||||
COPY container/${NGINX_CONF} /etc/nginx/conf.d/nginx.default.conf
|
||||
21
container/nginx.conf
Normal file
21
container/nginx.conf
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
add_header Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; manifest-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'" always;
|
||||
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
add_header Referrer-Policy "no-referrer" always;
|
||||
add_header Permissions-Policy "accelerometer=(), autoplay=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), microphone=(), midi=(), payment=(), usb=()" always;
|
||||
add_header Cross-Origin-Opener-Policy "same-origin" always;
|
||||
add_header Cross-Origin-Embedder-Policy "require-corp" always;
|
||||
add_header Cross-Origin-Resource-Policy "same-origin" always;
|
||||
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
4
frontend/pnpm-workspace.yaml
Normal file
4
frontend/pnpm-workspace.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
allowBuilds:
|
||||
esbuild: true
|
||||
onlyBuiltDependencies:
|
||||
- esbuild
|
||||
Loading…
Add table
Add a link
Reference in a new issue