From 81532335294150fa0e61a9e9639debabcdfd0d2c Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Mon, 20 Jul 2026 10:48:25 +0300 Subject: [PATCH] =?UTF-8?q?chore:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20Dockerfile=20=D0=B8=20Caddyfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 5 +++++ Caddyfile | 22 ++++++++++++++++++++++ Dockerfile | 22 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .dockerignore create mode 100644 Caddyfile create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..584f5f0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.yarn/cache +.yarn/unplugged +.yarn/install-state.gz +dist \ No newline at end of file diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..5966acb --- /dev/null +++ b/Caddyfile @@ -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 +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4098e65 --- /dev/null +++ b/Dockerfile @@ -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"]