From 4f6eb301468bddc47b22559635be5d102dedf2cc Mon Sep 17 00:00:00 2001 From: Yash Chudasama Date: Sun, 7 Apr 2024 20:56:48 +0530 Subject: [PATCH 1/2] Added Docker Support --- Dockerfile | 13 +++++++++++++ README.md | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3ef2505 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# Stage 1: Build the NextJS Application +FROM node:20-alpine as build +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build + +# Stage 2: Setup the Nginx Server to serve the NextJS Application +FROM nginx:stable-alpine3.17 as production +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/README.md b/README.md index 9e7e149..e49be93 100644 --- a/README.md +++ b/README.md @@ -36,5 +36,12 @@ npm install npm run build ``` +### Docker Build +```bash +docker build -t drawdb . +docker run -p 3000:80 drawdb +``` + + Set up the [server](https://github.com/drawdb-io/drawdb-server) and environment variables according to `.env.sample` for the survey and bug report forms. From 3ca2da3e057158f1a61b0bef1e57e86303266ede Mon Sep 17 00:00:00 2001 From: Yash Chudasama Date: Wed, 10 Apr 2024 11:21:04 +0530 Subject: [PATCH 2/2] Updated nginx default.conf file --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 3ef2505..724eafa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,6 @@ RUN npm run build # Stage 2: Setup the Nginx Server to serve the NextJS Application FROM nginx:stable-alpine3.17 as production COPY --from=build /app/dist /usr/share/nginx/html +RUN echo 'server { listen 80; server_name _; root /usr/share/nginx/html; location / { try_files $uri /index.html; } }' > /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file