From 187d1da8514fca0c685a60e36d00c99ef4afc3e8 Mon Sep 17 00:00:00 2001 From: Moses Mbadi Date: Sat, 11 Mar 2023 16:17:04 +0300 Subject: [PATCH] added docker --- Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ docker-compose.yml | 13 +++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e99a4e2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ + +# minimal alpine image for quick dev build +# FROM mhart/alpine-node + + +FROM node:alpine +WORKDIR /app +COPY . . +RUN yarn install +RUN yarn build +EXPOSE 3000 +CMD ["yarn", "start"] + + + +#For production environment +# FROM node:alpine as BUILD_IMAGE +# WORKDIR /app +# COPY package.json yarn.lock ./ +# # install dependencies +# RUN yarn install --frozen-lockfile +# COPY . . +# # build +# RUN yarn build +# # remove dev dependencies +# RUN npm prune --production + +# FROM node:alpine +# WORKDIR /app +# # copy from build image +# COPY --from=BUILD_IMAGE /app/package.json ./package.json +# COPY --from=BUILD_IMAGE /app/node_modules ./node_modules +# COPY --from=BUILD_IMAGE /app/.next ./.next +# COPY --from=BUILD_IMAGE /app/public ./public +# EXPOSE 3000 +# CMD ["yarn", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..491c190 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.8' +services: + web: + build: + context: ./ + + volumes: + - .:/app + command: npm run dev + ports: + - "3000:3000" + environment: + NODE_ENV: development