0
0
mirror of https://github.com/sp-tarkov/db-website.git synced 2025-02-08 04:50:46 -05:00
db-website/Dockerfile

39 lines
858 B
Docker
Raw Normal View History

ARG PROD=false
2024-12-07 13:15:03 -05:00
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/*
# Install Latest Bun
RUN curl -fsSL https://bun.sh/install | bash
ENV BUN_INSTALL="/root/.bun"
ENV PATH="$BUN_INSTALL/bin:$PATH"
2024-12-07 13:15:03 -05:00
# Set up working directory
WORKDIR /app
# Copy and build frontend
COPY frontend ./frontend
WORKDIR /app/frontend
RUN npm install
# Conditionally run production or development build
RUN if [ "$PROD" = "true" ]; then npm run build:prod; else npm run build; fi
2024-12-07 13:15:03 -05:00
# Move built frontend assets into backend public directory
WORKDIR /app
RUN mkdir -p ./api/public
RUN cp -r ./frontend/dist/* ./api/public/
2024-12-07 13:15:03 -05:00
# Copy and build backend
COPY api ./api
WORKDIR /app/api
RUN cp .env.example .env
RUN bun install
2024-12-07 13:15:03 -05:00
# Final setup
WORKDIR /app/api
EXPOSE 3001
CMD ["bun", "run", "start"]