From 278db32521eeffe7c1eb414ef3bdec2c82898134 Mon Sep 17 00:00:00 2001 From: antondlr Date: Thu, 16 May 2024 12:04:30 +0300 Subject: [PATCH] add development `Dockerfile` --- Dockerfile | 23 ----------------------- Dockerfile.dev | 17 +++++++++++------ Dockerfile.release | 3 --- docker-entrypoint-dev.sh | 8 ++++++++ 4 files changed, 19 insertions(+), 32 deletions(-) delete mode 100644 Dockerfile delete mode 100644 Dockerfile.release create mode 100755 docker-entrypoint-dev.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 33256115..00000000 --- a/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -ARG node_version=18 -ARG node_image=node:${node_version} - -# STAGE 1: builder -FROM $node_image AS builder - -COPY . /app/ -WORKDIR /app - -ENV NODE_ENV=development - -# install (dev) deps -# on GitHub runners, timeouts occur in emulated containers -RUN yarn --network-timeout 300000 - -ENV NODE_ENV=production -# build (prod) app -RUN yarn build - -# STAGE 2 -FROM nginx:alpine AS production - -COPY --from=builder /app/build/ /usr/share/nginx/html/ diff --git a/Dockerfile.dev b/Dockerfile.dev index b67b0450..db5eed66 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,12 +1,17 @@ ARG node_version=18 ARG node_image=node:${node_version} -FROM $node_image -ENV NODE_ENV=development +FROM $node_image AS dev -EXPOSE 5000/tcp COPY . /app/ -WORKDIR /app +WORKDIR /app/backend + +ENV NODE_ENV=development + +# install (dev) deps +# on GitHub runners, timeouts occur in emulated containers +RUN yarn --network-timeout 300000 + +ENTRYPOINT /app/docker-entrypoint-dev.sh -RUN yarn install -CMD ["yarn", "run", "dev"] \ No newline at end of file +# run with docker run --rm -ti -p 3000:3000 -v $PWD/.env:/app/.env:ro your-image-name diff --git a/Dockerfile.release b/Dockerfile.release deleted file mode 100644 index 86e40597..00000000 --- a/Dockerfile.release +++ /dev/null @@ -1,3 +0,0 @@ -FROM nginx:alpine - -COPY html/ /usr/share/nginx/html/ diff --git a/docker-entrypoint-dev.sh b/docker-entrypoint-dev.sh new file mode 100755 index 00000000..54f5dd06 --- /dev/null +++ b/docker-entrypoint-dev.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cd /app/backend +yarn start & + +cd /app + +yarn dev