Skip to content

Commit

Permalink
Issue with dockerfile build stages
Browse files Browse the repository at this point in the history
  • Loading branch information
refringe committed Dec 7, 2024
1 parent 33e5830 commit 2384d54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ https://db.sp-tarkov.com
## Run Docker Image

- `docker pull ghcr.io/sp-tarkov/db-website:main`
- `docker run -p 3001:3001 db-website:main`
- `docker run -p 3001:3001 ghcr.io/sp-tarkov/db-website:main`

## Local Build

Expand Down

0 comments on commit 2384d54

Please sign in to comment.