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:
parent
33e5830405
commit
2384d54107
30
Dockerfile
30
Dockerfile
@ -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"]
|
Loading…
x
Reference in New Issue
Block a user