Created
November 22, 2022 13:34
-
-
Save regner/888ca194c64c5b28667580f79db412b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build image | |
FROM node:16-bullseye as build | |
# Set working directory for easy copy from later | |
WORKDIR /app | |
# Copy everything else over so we can build | |
COPY . . | |
# Install Node packages | |
# We use yarn because npm is actually unable to resolve the dependency graph. | |
RUN yarn install | |
# Build the dashboard | |
RUN yarn build | |
# Deployment image | |
FROM nginx:1.21.3 | |
ARG version_info | |
# Set working directory to nginx asset directory | |
WORKDIR /usr/share/nginx/html | |
# Remove default nginx static assets | |
RUN rm -rf ./* | |
COPY --from=build /app/config/nginx.conf /etc/nginx/conf.d/default.conf | |
COPY --from=build /app/build . | |
# Runtime static config | |
ENV REACT_APP_VERSION_INFO=${version_info} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
large_client_header_buffers 4 64k; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
try_files $uri $uri/ /index.html =404; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment