From cd92c9125871dd875c0604891a73e1ab63d8c0c0 Mon Sep 17 00:00:00 2001 From: Victor Zheng <36215359+victorzheng02@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:12:22 -0800 Subject: [PATCH] dockerize application (#188) In preparation for deploy. Dockerize the backend and frontend --------- Co-authored-by: Anson He <60114875+ansonjwhe@users.noreply.github.com> --- 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..85e834c 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"]