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 (
<React.Fragment>
<AddItemForm onNewItem={onNewItem} />
{items.length === 0 && (
<p className="text-center">No items yet! Add one above!</p>
{items.length === 0 && (
<p className="text-center">You have no todo items yet! Add one above!</p>
)}
{items.map(item => (
<ItemDisplay

View File

@ -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: