ipify/frontend/Dockerfile
2026-05-15 18:24:59 +03:00

35 lines
864 B
Docker

# Build stage
FROM harbor.dvirlabs.com/base-images/node:18-alpine AS build
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy application code
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM harbor.dvirlabs.com/base-images/nginx:alpine
# Copy built files from build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Create entrypoint script to inject env variables
RUN echo '#!/bin/sh' > /docker-entrypoint.d/40-generate-env.sh && \
echo 'echo "window.ENV = { VITE_API_URL: \"${VITE_API_URL}\" };" > /usr/share/nginx/html/env.js' >> /docker-entrypoint.d/40-generate-env.sh && \
chmod +x /docker-entrypoint.d/40-generate-env.sh
# Expose port
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]