43 lines
1.4 KiB
Docker
43 lines
1.4 KiB
Docker
# web/frontend/Dockerfile
|
|
# Build context must be the project root.
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
# Install Python for the generation script
|
|
RUN apk add --no-cache python3 py3-pip
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy frontend package files and install dependencies
|
|
COPY web/frontend/package.json web/frontend/package-lock.json* ./
|
|
RUN npm install
|
|
|
|
# Copy the frontend source code
|
|
COPY web/frontend/ .
|
|
|
|
# Copy the Python defaults and the generation script into the expected location
|
|
# The generate script in package.json expects ../../scripts/generate_ts_defaults.py
|
|
# So we must place it at /app/../../scripts/ which is /scripts/
|
|
# But we can't COPY to a parent directory. Instead, we'll copy to /app/scripts/
|
|
# and adjust the package.json script to use ./scripts/generate_ts_defaults.py
|
|
# Actually, the simplest fix is to copy to /app/scripts/ and then adjust package.json.
|
|
#
|
|
# Let's use a different approach: copy to /app/scripts/ and update the generate script.
|
|
COPY audio_splitter/defaults.py /app/scripts/defaults.py
|
|
COPY scripts/generate_ts_defaults.py /app/scripts/generate_ts_defaults.py
|
|
|
|
# Run the generation script
|
|
RUN python /app/scripts/generate_ts_defaults.py
|
|
|
|
# Build the frontend
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production (nginx)
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
COPY web/frontend/nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|