-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Docker Compose-based development workflow #4
Changes from all commits
366e012
d94cce0
421d0a6
5742e50
038c5ae
525dda7
6d704c1
6ff0190
9579702
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
./.git/* | ||
./.vscode/* | ||
**/node_modules/* | ||
./.git/**/* | ||
./.vscode/**/* | ||
**/node_modules/**/* | ||
secrets/**/*.enc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:alpine | ||
FROM node:9-alpine | ||
|
||
RUN apk update -q && apk add git -q | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM node:9-alpine | ||
|
||
RUN apk update -q && apk add git -q | ||
|
||
ENV NODE_ENV=development | ||
ENV PORT=8080 | ||
|
||
EXPOSE 8080 | ||
EXPOSE 9229 | ||
|
||
VOLUME /code | ||
VOLUME /code/node_modules | ||
|
||
WORKDIR /code | ||
|
||
CMD yarn && yarn dev |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: "3.3" | ||
|
||
services: | ||
database: | ||
image: mysql | ||
restart: on-failure | ||
ports: | ||
- 3306:3306 | ||
expose: | ||
- 3306 | ||
environment: | ||
- MYSQL_DATABASE=hollowverse | ||
- MYSQL_ROOT_PASSWORD=123456 | ||
- MYSQL_ROOT_HOST=% | ||
|
||
api: | ||
restart: always | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
depends_on: | ||
- database | ||
build: | ||
dockerfile: Dockerfile-dev | ||
context: . | ||
links: | ||
- database | ||
ports: | ||
- 8080:8080 | ||
- 9229:9229 | ||
volumes: | ||
- type: bind | ||
source: . | ||
target: /code | ||
|
||
- type: volume | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The volume created with type
|
||
source: nm | ||
target: /code/node_modules | ||
environment: | ||
- RDS_HOSTNAME=database | ||
- RDS_USERNAME=root | ||
- RDS_PASSWORD=123456 | ||
|
||
volumes: | ||
nm: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
const { | ||
NODE_ENV, | ||
|
||
// To use the production database, this must be set explicitly to 'true' | ||
// in EB environment settings. Otherwise, the testing database is used. | ||
USE_PRODUCTION_DATABASE, | ||
} = process.env; | ||
|
||
export const isProd = NODE_ENV === 'production'; | ||
|
||
export const isUsingProductionDatabase = | ||
process.env.NODE_ENV === 'production' && USE_PRODUCTION_DATABASE === 'true'; | ||
isProd && USE_PRODUCTION_DATABASE === 'true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's
on-failure
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tells Docker Compose to restart MySQL server when the server command exits with a non-zero exit code.