From ecf90a96a670d11b22cc7aa5d59b1abbcdc4fd5a Mon Sep 17 00:00:00 2001 From: Benhammou Mohammed Rachid <mrbenhammou@takima.fr> Date: Thu, 23 May 2024 14:49:24 +0200 Subject: [PATCH] add dockerfile --- .dockerignore | 4 ++++ Dockerfile | 12 ++++++++++++ nginx-custom.conf | 20 ++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx-custom.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f56ff1c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +/node_modules +.idea +.prettierrc.json +yarn-error.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ebc5caf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:18-alpine as build-stage + +WORKDIR /app +COPY package*.json /app/ +RUN npm install +COPY ./ /app/ +ARG configuration=production +RUN npm run build -- --output-path=./dist/out --configuration $configuration + +FROM nginx:1.15 +COPY --from=build-stage /app/dist/out/ /usr/share/nginx/html +COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf diff --git a/nginx-custom.conf b/nginx-custom.conf new file mode 100644 index 0000000..2c11f9b --- /dev/null +++ b/nginx-custom.conf @@ -0,0 +1,20 @@ +# Expires map +map $sent_http_content_type $expires { + default off; + text/html epoch; + text/css max; + application/json max; + application/javascript max; + ~image/ max; +} + +server { + listen 80; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html =404; + } + expires $expires; + gzip on; +} \ No newline at end of file -- GitLab