Skip to content

Instantly share code, notes, and snippets.

@gsaslis
Created May 17, 2024 09:28
Show Gist options
  • Save gsaslis/46864c1f9c016da6f4db06b83c7e9aa0 to your computer and use it in GitHub Desktop.
Save gsaslis/46864c1f9c016da6f4db06b83c7e9aa0 to your computer and use it in GitHub Desktop.
boards docker-compose deployment
version: '3.8'
services:
boards:
build:
dockerfile: ./Containerfile
context: ./radicle-planning-boards/
environment:
NUXT_PUBLIC_PARENT_ORIGIN: http://localhost:3080
ports:
- "3090:80"
volumes:
- ./radicle-planning-boards/Caddyfile:/etc/caddy/Caddyfile
- boards_caddy_data:/data
web:
build:
dockerfile: ./Containerfile
context: ./radicle-interface-with-planning-boards/
ports:
- "3080:80"
# environment:
# NUXT_PUBLIC_PARENT_ORIGIN: http://localhost:3080
volumes:
- ./radicle-interface-with-planning-boards/Caddyfile:/etc/caddy/Caddyfile
- web_caddy_data:/data
volumes:
boards_caddy_data:
web_caddy_data:
localhost:80 {
@skip path_regexp \.(wasm|js|css|png|jpe?g|gif|ico|woff2?|otf|ttf|eot|svg|txt|pdf|docx?|xlsx?)$
@static {
file
path *.ico *.css *.js *.gif *.webp *.avif *.jpg *.jpeg *.png *.svg *.woff *.woff2
}
# header @static Cache-Control "public, max-age=259200"
root * /usr/share/caddy
encode zstd gzip
try_files {path} /index.html
file_server
}
FROM node:20 as build
WORKDIR /app
COPY . ./
RUN npm install
RUN npm run build
FROM caddy:2.8-alpine
COPY --from=build /app/build /usr/share/caddy
localhost:80 {
@skip path_regexp \.(wasm|js|css|png|jpe?g|gif|ico|woff2?|otf|ttf|eot|svg|txt|pdf|docx?|xlsx?)$
@static {
file
path *.ico *.css *.js *.gif *.webp *.avif *.jpg *.jpeg *.png *.svg *.woff *.woff2
}
header @static Cache-Control "public, max-age=259200"
root * /usr/share/caddy
encode zstd gzip
try_files {path} /index.html
file_server
}
ARG NODE_VERSION=20
ARG CADDY_VERSION="2.8"
FROM node:${NODE_VERSION}-slim as build
# corepack is an experimental feature in Node.js v20 which allows
# installing and managing versions of pnpm, npm, yarn
RUN corepack enable
ENV NODE_ENV=production
WORKDIR /src
COPY package.json pnpm-lock.yaml .
#RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --production=false
RUN pnpm install --production=false
COPY . .
RUN pnpm run build
# Run
FROM caddy:${CADDY_VERSION}-alpine
COPY --from=build /src/.output/public /usr/share/caddy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment