You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
490 B
Docker
26 lines
490 B
Docker
# Stage 1: build the React app
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
|
|
# These are baked into the JS bundle at build time
|
|
ARG REACT_APP_API_URL
|
|
ARG REACT_APP_SERIAL_URL
|
|
ENV REACT_APP_API_URL=$REACT_APP_API_URL
|
|
ENV REACT_APP_SERIAL_URL=$REACT_APP_SERIAL_URL
|
|
|
|
RUN npm run build
|
|
|
|
# Stage 2: serve with nginx
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/build /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|