This commit is contained in:
MaolinPan 2021-06-11 08:29:13 +00:00 committed by GitHub
commit 97460a0d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 8 deletions

7
app/Dockerfile Normal file
View File

@ -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"]

View File

@ -52,8 +52,8 @@ function TodoListCard() {
return ( return (
<React.Fragment> <React.Fragment>
<AddItemForm onNewItem={onNewItem} /> <AddItemForm onNewItem={onNewItem} />
{items.length === 0 && ( {items.length === 0 && (
<p className="text-center">No items yet! Add one above!</p> <p className="text-center">You have no todo items yet! Add one above!</p>
)} )}
{items.map(item => ( {items.map(item => (
<ItemDisplay <ItemDisplay

View File

@ -1,12 +1,27 @@
version: "3.7" version: "3.7"
services: services:
docs: app:
build: image: node:12-alpine
context: . command: sh -c "yarn install && yarn run dev"
dockerfile: Dockerfile
target: dev
ports: ports:
- 8000:8000 - 3000:3000
working_dir: /app
volumes: volumes:
- ./:/app - ./:/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: