Last active
July 26, 2023 17:23
-
-
Save bastienapp/afef8b6315628411582b45e8d04143f4 to your computer and use it in GitHub Desktop.
Docker deployment: Angular
This file contains hidden or 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
# default.conf | |
server { | |
listen 4200; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
try_files $uri $uri/ /index.html; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
} |
This file contains hidden or 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
# Dockerfile frontend | |
# build environment | |
FROM node:lts-slim as build | |
WORKDIR /build | |
COPY . . | |
ENV PATH ./node_modules/.bin:$PATH | |
RUN npm ci | |
RUN ng build --configuration production --output-path=dist | |
# production environment | |
FROM nginx:stable-alpine-slim | |
COPY --from=build /build/dist/ /usr/share/nginx/html | |
COPY default.conf /etc/nginx/conf.d/ | |
EXPOSE 4200 | |
CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment