Skip to content

Commit

Permalink
Merge pull request #3 from camptocamp/GSGGR-125_dockerize_FE
Browse files Browse the repository at this point in the history
Rework docker file
  • Loading branch information
marionb authored Aug 9, 2024
2 parents eddf728 + 4312365 commit 8fe2929
Show file tree
Hide file tree
Showing 3 changed files with 797 additions and 18 deletions.
32 changes: 14 additions & 18 deletions Dockerfile
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
10 changes: 10 additions & 0 deletions nginx/default.conf
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;
}
}
Loading

0 comments on commit 8fe2929

Please sign in to comment.