From 734417b0a65e39dccfb23f31cacd007af5b2f15c Mon Sep 17 00:00:00 2001 From: Halit Aksoy Date: Fri, 4 Oct 2024 23:31:55 +0300 Subject: [PATCH] (frontend) add docker file --- apps/frontend/.dockerignore | 2 ++ apps/frontend/Dockerfile | 23 +++++++++++++++++++++++ apps/frontend/nginx/nginx.conf | 8 ++++++++ 3 files changed, 33 insertions(+) create mode 100644 apps/frontend/.dockerignore create mode 100644 apps/frontend/Dockerfile create mode 100644 apps/frontend/nginx/nginx.conf diff --git a/apps/frontend/.dockerignore b/apps/frontend/.dockerignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/apps/frontend/.dockerignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/apps/frontend/Dockerfile b/apps/frontend/Dockerfile new file mode 100644 index 0000000..aed5e02 --- /dev/null +++ b/apps/frontend/Dockerfile @@ -0,0 +1,23 @@ +FROM node:20-alpine3.19 AS build + +WORKDIR /app + +COPY package.json ./ + +COPY yarn.lock ./ + +RUN yarn install + +COPY . ./ + +RUN yarn build + +FROM nginx:stable-alpine + +COPY --from=build /app/dist /usr/share/nginx/html + +COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 3000 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/apps/frontend/nginx/nginx.conf b/apps/frontend/nginx/nginx.conf new file mode 100644 index 0000000..b6a6d3a --- /dev/null +++ b/apps/frontend/nginx/nginx.conf @@ -0,0 +1,8 @@ +server { + listen 3000; + location / { + root /usr/share/nginx/html/; + include /etc/nginx/mime.types; + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file