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:
parent
2384d54107
commit
42ae753d5b
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@ -48,6 +48,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
build-args: |
|
||||||
|
PROD=true
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
ARG PROD=false
|
||||||
|
|
||||||
FROM node:20.12-slim
|
FROM node:20.12-slim
|
||||||
|
|
||||||
# Update and install dependencies
|
# Update and install dependencies
|
||||||
@ -15,7 +17,9 @@ WORKDIR /app
|
|||||||
COPY frontend ./frontend
|
COPY frontend ./frontend
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
RUN npm install
|
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
|
# Move built frontend assets into backend public directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -31,4 +35,4 @@ RUN bun install
|
|||||||
# Final setup
|
# Final setup
|
||||||
WORKDIR /app/api
|
WORKDIR /app/api
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
CMD ["bun", "run", "start"]
|
CMD ["bun", "run", "start"]
|
||||||
|
11
README.md
11
README.md
@ -3,11 +3,6 @@
|
|||||||
Source for the SPT DB Item Lookup website hosted at:
|
Source for the SPT DB Item Lookup website hosted at:
|
||||||
https://db.sp-tarkov.com
|
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
|
## Local Build
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
@ -32,3 +27,9 @@ Build the back-end:
|
|||||||
|
|
||||||
Start the local server:
|
Start the local server:
|
||||||
- `bun run start`
|
- `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
|
Loading…
x
Reference in New Issue
Block a user