All checks were successful
Build And Test / build-and-push (push) Successful in 1m53s
42 lines
994 B
Plaintext
42 lines
994 B
Plaintext
# Build stage
|
|
FROM node:20.11 as builder
|
|
|
|
# Build arguments for React environment variables
|
|
ARG REACT_APP_API_AUTH
|
|
ARG REACT_APP_API_BLOG
|
|
|
|
# Set working directory
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy package.json and package-lock.json (if available)
|
|
COPY package.json package-lock.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application
|
|
COPY . ./
|
|
|
|
# Set env vars for React build (only works if passed as build-arg)
|
|
ENV REACT_APP_API_AUTH=$REACT_APP_API_AUTH
|
|
ENV REACT_APP_API_BLOG=$REACT_APP_API_BLOG
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copy the build output to Nginx html directory
|
|
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
|
|
|
|
# Copy Nginx configuration file
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start Nginx server
|
|
CMD ["nginx", "-g", "daemon off;"]
|
|
|
|
# docker build -t harbor.icurfer.com/msa-demo/msa-fe:kong-0 --build-arg REACT_APP_API_AUTH=https://www.demo.test --build-arg |