From 86f4f04f4c588a30748c887b57baced49077a804 Mon Sep 17 00:00:00 2001 From: Victor Zheng Date: Sun, 25 Feb 2024 23:12:54 -0800 Subject: [PATCH 1/2] dockerize application --- README.md | 22 +++++++++++++++++++++- backend/Dockerfile | 7 +++++++ frontend/Dockerfile | 7 +++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 backend/Dockerfile create mode 100644 frontend/Dockerfile diff --git a/README.md b/README.md index 1c72b5d..76feff9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Setup Guide +# Setup Guide - LOCAL After you clone the repository, run @@ -118,6 +118,26 @@ cd frontend npm start ``` +# Docker setup + +Assuming your .env files are configured properly, you can run them in docker containers as well. + +## Docker setup - frontend + +``` +cd frontend +docker build -t wato-finance-frontend . +docker run -p 3000:3000 -d wato-finance-frontend +``` + +## Docker setup - backend + +``` +cd backend +docker build -t wato-finance-backend. +docker run -p 5000:5000 -d wato-finance-backend +``` + --- ## Notes diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..5b3c23d --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,7 @@ +FROM node:14 +WORKDIR /usr/src/app/backend +COPY package*.json ./ +RUN npm install +COPY . . +EXPOSE 5000 +CMD ["node", "server.js"] diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..9a91400 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,7 @@ +FROM node:14 +WORKDIR /usr/src/app/frontend +COPY package*.json ./ +RUN npm install +COPY . . +EXPOSE 3000 +CMD ["npm", "start"] From a6a90bbcf678da4bfac87e21dc23d4562cb959ec Mon Sep 17 00:00:00 2001 From: Victor Zheng <36215359+victorzheng02@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:12:15 -0800 Subject: [PATCH 2/2] Update README.md Co-authored-by: Anson He <60114875+ansonjwhe@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 76feff9..85e834c 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ docker run -p 3000:3000 -d wato-finance-frontend ``` cd backend -docker build -t wato-finance-backend. +docker build -t wato-finance-backend . docker run -p 5000:5000 -d wato-finance-backend ```