Merge pull request 'chore: Добавлен Dockerfile и Caddyfile' (#8) from chore/docker into main
Build and push / build (push) Successful in 40s

Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
2026-07-20 07:57:53 +00:00
3 changed files with 49 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
node_modules
.yarn/cache
.yarn/unplugged
.yarn/install-state.gz
dist
+22
View File
@@ -0,0 +1,22 @@
:3000 {
root * /usr/share/caddy
encode {
zstd
gzip
match {
header Content-Type text/*
header Content-Type application/javascript*
header Content-Type application/json*
header Content-Type image/svg+xml*
}
}
@assets path /assets/*
header @assets Cache-Control "public, max-age=31536000, immutable"
@html path / /index.html
header @html Cache-Control "no-cache"
file_server
}
+22
View File
@@ -0,0 +1,22 @@
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Enable Corepack so we can use Yarn v4 (pinned to match lockfile)
RUN corepack enable && corepack prepare yarn@4.11.0 --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 && ls -la dist
# Production stage - Caddy
FROM caddy:2-alpine
WORKDIR /usr/share/caddy
# Copy built static files from the builder stage
COPY --from=builder /app/dist .
# Copy our local Caddyfile config
COPY Caddyfile /etc/caddy/Caddyfile
EXPOSE 3000
# Start caddy using the config file
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]