-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from camptocamp/GSGGR-125_dockerize_FE
Rework docker file
- Loading branch information
Showing
3 changed files
with
797 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
### Compile ### | ||
FROM node:18.18-alpine as builder | ||
# Build with node | ||
FROM node:22.6.0-slim AS builder | ||
WORKDIR /usr/src/app | ||
ENV PATH=${PATH}:./node_modules/.bin | ||
ENV NODE_PATH=/usr/src/app/node_modules | ||
|
||
COPY package*.json ./ | ||
RUN npm install --no-progress --loglevel=error --no-audit | ||
RUN npm ci | ||
|
||
COPY . . | ||
ARG FRONT_HREF | ||
RUN npm run ng build -- --configuration production --base-href ${FRONT_HREF}/ | ||
|
||
### Run ### | ||
FROM httpd:alpine | ||
RUN rm -r /usr/local/apache2/htdocs/* | ||
COPY --from=builder /usr/src/app/dist/ /usr/local/apache2/htdocs/ | ||
COPY ./httpd.conf /usr/local/apache2/conf/ | ||
RUN npm run build | ||
|
||
# Serve with nginx unpprevileged | ||
FROM nginxinc/nginx-unprivileged:stable | ||
|
||
# copy server config | ||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Read only for user daemon | ||
RUN chown -R root:daemon \ | ||
/usr/local/apache2/htdocs/* | ||
RUN chmod -R 440 \ | ||
/usr/local/apache2/htdocs/* | ||
RUN find /usr/local/apache2/htdocs/ -mindepth 1 -type d -exec chmod +x {} \; | ||
# Copy build artifacts | ||
COPY --from=builder /usr/src/app/dist/ /usr/share/nginx/html |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
server { | ||
listen 8080; | ||
server_name localhost; | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri/ =404; | ||
} | ||
} |
Oops, something went wrong.