Files
todo-app/Dockerfile.all

32 lines
875 B
Docker

# ========== API Build ==========
FROM oven/bun:1 as api-builder
WORKDIR /app
COPY . .
WORKDIR /app/apps/api
RUN bun install --frozen-lockfile
FROM oven/bun:1-slim as api
WORKDIR /app
COPY --from=api-builder /app/apps/api/node_modules ./node_modules
COPY --from=api-builder /app/apps/api/package.json ./
COPY --from=api-builder /app/apps/api/src ./src
COPY --from=api-builder /app/apps/api/drizzle.config.ts ./
ENV NODE_ENV=production
ENV PORT=3001
EXPOSE 3001
CMD ["sh", "-c", "bun run db:push && bun run start"]
# ========== Web Build ==========
FROM oven/bun:1 as web-builder
WORKDIR /app
COPY . .
WORKDIR /app/apps/web
RUN bun install
RUN bun run build
FROM nginx:alpine as web
COPY --from=web-builder /app/apps/web/dist /usr/share/nginx/html
COPY --from=web-builder /app/apps/web/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]