From 1825b4c553de24d2b90b8e7e116a4b28a5e0d4f6 Mon Sep 17 00:00:00 2001 From: MaolinPan Date: Thu, 10 Jun 2021 20:49:05 +0800 Subject: [PATCH 1/3] add dockerfile for app --- app/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 app/Dockerfile diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 0000000..e9e336c --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,7 @@ + # syntax=docker/dockerfile:1 + FROM node:12-alpine + RUN apk add --no-cache python g++ make + WORKDIR /app + COPY . . + RUN yarn install --production + CMD ["node", "src/index.js"] \ No newline at end of file From a2e7cddbb11ed8a228540b2f25b00d964f848dd8 Mon Sep 17 00:00:00 2001 From: MaolinPan Date: Thu, 10 Jun 2021 21:32:07 +0800 Subject: [PATCH 2/3] app\src\static\app.js #56 "you have no todo items yet! Add one above" --- app/src/static/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/static/js/app.js b/app/src/static/js/app.js index 4ec962c..8a95f52 100644 --- a/app/src/static/js/app.js +++ b/app/src/static/js/app.js @@ -52,8 +52,8 @@ function TodoListCard() { return ( - {items.length === 0 && ( -

No items yet! Add one above!

+ {items.length === 0 && ( +

You have no todo items yet! Add one above!

)} {items.map(item => ( Date: Fri, 11 Jun 2021 16:22:27 +0800 Subject: [PATCH 3/3] running multiple containers using docker-compose --- docker-compose.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bdf8534..1a943cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,27 @@ version: "3.7" services: - docs: - build: - context: . - dockerfile: Dockerfile - target: dev + app: + image: node:12-alpine + command: sh -c "yarn install && yarn run dev" ports: - - 8000:8000 + - 3000:3000 + working_dir: /app volumes: - ./:/app + environment: + MYSQL_HOST: mysql + MYSQL_USER: root + MYSQL_PASSWORD: secret + MYSQL_DB: todos + + mysql: + image: mysql:5.7 + volumes: + - todo-mysql-data:/var/lib/mysql + environment: + MYSQL_ROOT_PASSWORD: secret + MYSQL_DATABASE: todos + +volumes: + todo-mysql-data: \ No newline at end of file