0
0
mirror of https://github.com/sp-tarkov/db-website.git synced 2025-02-02 17:49:21 -05:00

Conditional Docker Build

The docker build now includes a boolean argument for PROD:
`docker build --build-arg PROD=false -t db-website:local .`
This commit is contained in:
Refringe 2024-12-07 21:17:26 -05:00
parent 2384d54107
commit 42ae753d5b
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k
3 changed files with 14 additions and 7 deletions

View File

@ -48,6 +48,8 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
build-args: |
PROD=true
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -1,3 +1,5 @@
ARG PROD=false
FROM node:20.12-slim
# Update and install dependencies
@ -15,7 +17,9 @@ WORKDIR /app
COPY frontend ./frontend
WORKDIR /app/frontend
RUN npm install
RUN npm run build:prod
# Conditionally run production or development build
RUN if [ "$PROD" = "true" ]; then npm run build:prod; else npm run build; fi
# Move built frontend assets into backend public directory
WORKDIR /app
@ -31,4 +35,4 @@ RUN bun install
# Final setup
WORKDIR /app/api
EXPOSE 3001
CMD ["bun", "run", "start"]
CMD ["bun", "run", "start"]

View File

@ -3,11 +3,6 @@
Source for the SPT DB Item Lookup website hosted at:
https://db.sp-tarkov.com
## Run Docker Image
- `docker pull ghcr.io/sp-tarkov/db-website:main`
- `docker run -p 3001:3001 ghcr.io/sp-tarkov/db-website:main`
## Local Build
Requirements:
@ -32,3 +27,9 @@ Build the back-end:
Start the local server:
- `bun run start`
## Development with Docker
- `docker build --build-arg PROD=false -t db-website:local .`
- `docker run -p 3001:3001 db-website:local`
- Visit http://localhost:3001