Files
frontend-svelte/Dockerfile
Ilia Mashkov 3787ae260f
All checks were successful
Workflow / build (push) Successful in 56s
Workflow / publish (push) Successful in 51s
fix: update dockerfile with env variable for node linker
2026-02-09 14:28:55 +03:00

27 lines
744 B
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Enable Corepack so we can use Yarn v4
RUN corepack enable && corepack prepare yarn@stable --activate
# Force Yarn to use node_modules instead of PnP
ENV YARN_NODE_LINKER=node-modules
COPY package.json yarn.lock ./
RUN yarn install --immutable
COPY . .
RUN yarn build
# Production stage - Caddy
FROM caddy:2-alpine
WORKDIR /usr/share/caddy
# Copy built static files from the builder stage
COPY --from=builder /app/dist .
# Expose the port Caddy will listen on
EXPOSE 3000
# Start Caddy as a file server with SPA support
# It serves files from the current dir and redirects unknown paths to index.html
CMD ["caddy", "file-server", "--listen", ":3000", "--try-files", "index.html"]