ipify/frontend/Dockerfile
dvirlabs 3d4e39e52c
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Build and push app
2026-03-25 13:46:00 +02:00

35 lines
800 B
Docker

# Build stage
FROM 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 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;"]