ci: docker compose for easy access

This commit is contained in:
Syahdan 2026-05-25 13:40:09 +07:00
parent a6edf804b4
commit c42b8e2904
11 changed files with 249 additions and 13 deletions

33
apps/server/Dockerfile Normal file
View file

@ -0,0 +1,33 @@
# syntax=docker/dockerfile:1
FROM oven/bun:1.3.12 AS base
WORKDIR /app
ENV CI=1
COPY package.json bun.lock turbo.json tsconfig.json bts.jsonc ./
COPY apps ./apps
COPY packages ./packages
FROM base AS deps
RUN bun install --frozen-lockfile
FROM deps AS tools
ENV NODE_ENV=development
RUN touch apps/server/.env
FROM deps AS build
ENV NODE_ENV=production
RUN bun run --filter server build
FROM base AS prod-deps
RUN bun install --frozen-lockfile --production
FROM oven/bun:1.3.12 AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=build /app/apps/server/dist ./apps/server/dist
EXPOSE 3000
CMD ["bun", "apps/server/dist/index.mjs"]

21
apps/web/Dockerfile Normal file
View file

@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1
FROM oven/bun:1.3.12 AS build
WORKDIR /app
ENV CI=1
ARG VITE_SERVER_URL=http://localhost:3000
ENV VITE_SERVER_URL=${VITE_SERVER_URL}
COPY package.json bun.lock turbo.json tsconfig.json bts.jsonc ./
COPY apps ./apps
COPY packages ./packages
RUN bun install --frozen-lockfile
RUN bun run --filter web build
FROM nginx:1.27-alpine AS runtime
COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/apps/web/dist /usr/share/nginx/html
EXPOSE 80

11
apps/web/nginx.conf Normal file
View file

@ -0,0 +1,11 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}