From f7a22d391ba2d99d50eb1cef53efb6c89e73b574 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 3 Dec 2024 09:52:25 +0700 Subject: [PATCH] updated docker path --- docker/Dockerfile | 19 +++++++++++++++++++ entrypoint.sh => docker/entrypoint.sh | 0 nginx.conf => docker/nginx.conf | 0 Dockerfile | 21 --------------------- 4 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 docker/Dockerfile rename entrypoint.sh => docker/entrypoint.sh (100%) rename nginx.conf => docker/nginx.conf (100%) delete mode 100644 Dockerfile diff --git a/ docker/Dockerfile b/ docker/Dockerfile new file mode 100644 index 0000000..0b772dd --- /dev/null +++ b/ docker/Dockerfile @@ -0,0 +1,19 @@ +# docker buildx build --platform=linux/amd64 -f docker/Dockerfile . -t hrms-git.chin.in.th/bma-hrms/hrms-user:0.1 + +# Build Stage +FROM node:lts-alpine AS build-stage +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY ./ . +RUN npm run build + +# Production Stage +FROM nginx:stable-alpine AS production-stage +RUN mkdir /app +COPY --from=build-stage /app/dist /app +COPY docker/nginx.conf /etc/nginx/nginx.conf +COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod u+x /usr/local/bin/entrypoint.sh +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/entrypoint.sh b/ docker/entrypoint.sh similarity index 100% rename from entrypoint.sh rename to docker/entrypoint.sh diff --git a/nginx.conf b/ docker/nginx.conf similarity index 100% rename from nginx.conf rename to docker/nginx.conf diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a6b08ee..0000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# docker build . -t docker.frappet.com/demo/fe:latest -FROM node:latest as build-stage -WORKDIR /app -COPY package*.json ./ -RUN npm install -COPY ./ . - -RUN npm run build - -FROM nginx as production-stage - -RUN mkdir /app -COPY --from=build-stage /app/dist /app -COPY nginx.conf /etc/nginx/nginx.conf - -COPY entrypoint.sh /usr/local/bin/entrypoint.sh -RUN chmod u+x /usr/local/bin/entrypoint.sh - - -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] -CMD ["nginx", "-g", "daemon off;"]