puffin-app/Dockerfile

35 lines
932 B
Docker
Raw Normal View History

2025-05-13 18:50:30 +02:00
# Build Stage
FROM node:20-alpine AS build
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci
# Copy the rest of the app and build it
COPY . .
RUN npm run build
# Production Stage
FROM nginx:alpine
# Copy the built app from the build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy custom nginx config and environment script
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY env.sh /docker-entrypoint.d/40-env.sh
# Make the environment script executable
RUN chmod +x /docker-entrypoint.d/40-env.sh
# Create a place for the index.html to include the env-config.js script
RUN sed -i '/<head>/a \ <script src="/env-config.js"></script>' /usr/share/nginx/html/index.html || echo "Failed to inject env-config script tag"
2025-05-13 19:02:08 +02:00
# Expose port 3800 (changed from 80)
EXPOSE 3800
2025-05-13 18:50:30 +02:00
# Start Nginx server (the entrypoint scripts will run first)
CMD ["nginx", "-g", "daemon off;"]