diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c925c21 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/dist +/node_modules diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..693c43e --- /dev/null +++ b/Caddyfile @@ -0,0 +1,30 @@ +# global options +{ + admin off # theres no need for the admin api in railway's environment + persist_config off # storage isn't persistent anyway + auto_https off # railway handles https for us, this would cause issues if left enabled + log { # runtime logs + format console # set runtime log format to console mode + } +} + +:3000 { + log { # access logs + format console # set access log format to console mode + } + + # health check for railway + respond /health 200 + + # serve from the 'dist' folder (Vite builds into the 'dist' folder) + root * /app/dist + + # enable gzipping responses + encode gzip + + # serve files from 'dist' + file_server + + # if path doesn't exist, redirect it to 'index.html' for client side routing + try_files {path} /index.html +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0310d8e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# syntax=docker/dockerfile:1 + +FROM oven/bun:1 AS deps +WORKDIR /app +COPY package.json package.json +COPY bun.lockb bun.lockb +RUN bun install + +FROM node:18-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +RUN yarn build + +FROM caddy AS runner +COPY --from=builder /app/dist /usr/share/caddy