From fcced63c34a5061b770c63d2f5647ac2a353e02b Mon Sep 17 00:00:00 2001 From: Pau Costa Date: Thu, 1 Feb 2024 17:58:22 +0100 Subject: [PATCH] :bricks: Docker configuration Signed-off-by: Pau Costa --- client/Dockerfile | 17 +++++++++++++++++ docker-compose.yml | 28 ++++++++++++++++++++++++++++ server/Dockerfile | 15 +++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 client/Dockerfile create mode 100644 docker-compose.yml create mode 100644 server/Dockerfile diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..2d9c063 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,17 @@ +FROM node:18 +LABEL authors="Pau Costa" + +WORKDIR /usr/local/app + +COPY package.json ./ +RUN npm install + +COPY tsconfig.json ./ +COPY src ./src +COPY public ./public + +EXPOSE 3000 + +CMD ["npm", "run", "start"] + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5340e57 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: '3.7' +services: + client: + container_name: node_app_client + restart: unless-stopped + build: ./client + ports: + - "8080:3000" + server: + container_name: node_app_server + restart: unless-stopped + build: ./server + ports: + - "3000:3000" + environment: + MYSQL_DATABASE: node_app + MYSQL_USER: node_app + MYSQL_PASSWORD: TestPasswordPleaseChange + depends_on: + - db + db: + image: mysql:5.7 + restart: unless-stopped + environment: + MYSQL_RANDOM_ROOT_PASSWORD: '1' + MYSQL_DATABASE: node_app + MYSQL_USER: node_app + MYSQL_PASSWORD: TestPasswordPleaseChange \ No newline at end of file diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..44c674f --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,15 @@ +FROM node:18 +LABEL authors="Pau Costa" + +WORKDIR /usr/local/app + +COPY package.json ./ +RUN npm install + +COPY tsconfig.json ./ +COPY src ./src + +EXPOSE 3000 + +CMD ["npm", "run", "start"] +