0
0
mirror of https://github.com/sp-tarkov/db-website.git synced 2025-02-08 02:10:54 -05:00

Issue with dockerfile build stages

This commit is contained in:
Refringe 2024-12-07 13:15:03 -05:00
parent 33e5830405
commit 2384d54107
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k
2 changed files with 16 additions and 16 deletions

View File

@ -1,4 +1,4 @@
FROM node:20.12-slim AS base
FROM node:20.12-slim
# Update and install dependencies
RUN apt-get update && apt-get install -y curl unzip && rm -rf /var/lib/apt/lists/*
@ -8,27 +8,27 @@ RUN curl -fsSL https://bun.sh/install | bash
ENV BUN_INSTALL="/root/.bun"
ENV PATH="$BUN_INSTALL/bin:$PATH"
# Frontend build stage
FROM base AS frontend-build
# Set up working directory
WORKDIR /app
# Copy and build frontend
COPY frontend ./frontend
WORKDIR /app/frontend
COPY frontend .
RUN npm install
RUN npm run build:prod
# Copy built frontend into backend public directory
FROM base AS backend-build
WORKDIR /app/api
RUN mkdir -p /app/api/public
COPY --from=frontend-build /app/frontend/dist/* /app/api/public/
# Move built frontend assets into backend public directory
WORKDIR /app
RUN mkdir -p ./api/public
RUN cp -r ./frontend/dist/* ./api/public/
# Backend build stage
COPY api .
# Copy and build backend
COPY api ./api
WORKDIR /app/api
RUN cp .env.example .env
RUN bun install
# Final image
FROM base
# Final setup
WORKDIR /app/api
COPY --from=backend-build /app/api .
EXPOSE 3001
CMD ["bun", "run", "start"]
CMD ["bun", "run", "start"]

View File

@ -6,7 +6,7 @@ https://db.sp-tarkov.com
## Run Docker Image
- `docker pull ghcr.io/sp-tarkov/db-website:main`
- `docker run -p 3001:3001 db-website:main`
- `docker run -p 3001:3001 ghcr.io/sp-tarkov/db-website:main`
## Local Build