diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index aecf928..74b21bf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 }} diff --git a/Dockerfile b/Dockerfile index 4ec0fba..677405b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file +CMD ["bun", "run", "start"] diff --git a/README.md b/README.md index 2b6629f..a9c0665 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file