0
0
mirror of https://github.com/sp-tarkov/db-website.git synced 2025-02-08 04:50:46 -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 # Update and install dependencies
RUN apt-get update && apt-get install -y curl unzip && rm -rf /var/lib/apt/lists/* 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 BUN_INSTALL="/root/.bun"
ENV PATH="$BUN_INSTALL/bin:$PATH" ENV PATH="$BUN_INSTALL/bin:$PATH"
# Frontend build stage # Set up working directory
FROM base AS frontend-build WORKDIR /app
# Copy and build frontend
COPY frontend ./frontend
WORKDIR /app/frontend WORKDIR /app/frontend
COPY frontend .
RUN npm install RUN npm install
RUN npm run build:prod RUN npm run build:prod
# Copy built frontend into backend public directory # Move built frontend assets into backend public directory
FROM base AS backend-build WORKDIR /app
WORKDIR /app/api RUN mkdir -p ./api/public
RUN mkdir -p /app/api/public RUN cp -r ./frontend/dist/* ./api/public/
COPY --from=frontend-build /app/frontend/dist/* /app/api/public/
# Backend build stage # Copy and build backend
COPY api . COPY api ./api
WORKDIR /app/api
RUN cp .env.example .env RUN cp .env.example .env
RUN bun install RUN bun install
# Final image # Final setup
FROM base
WORKDIR /app/api WORKDIR /app/api
COPY --from=backend-build /app/api .
EXPOSE 3001 EXPOSE 3001
CMD ["bun", "run", "start"] CMD ["bun", "run", "start"]

View File

@ -6,7 +6,7 @@ https://db.sp-tarkov.com
## Run Docker Image ## Run Docker Image
- `docker pull ghcr.io/sp-tarkov/db-website:main` - `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 ## Local Build