forked from owid/owid-grapher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.devcontainer.yml
80 lines (68 loc) · 3.16 KB
/
docker-compose.devcontainer.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
version: "3.7"
# This docker-compose file creates a full local dev environment for grapher to be used
# in a Visual Studio Code Remote Container extension workflow. It is targeted at the general public to
# easly get started.
# This setup allows for all development to happen inside docker containers, i.e. the host only has to have
# Docker, VS Code and the VS Code Remote Container extension installed.
# The mysql database server is exposed on the host at the nonstandard port of 3307 so you can use DB admin
# utilities on the host working against localhost:3307. When connecting from inside a container (i.e. using
# host: db) then make sure to use the default port 3306.
# You should not start this docker-compose file manually. Everything will be managed by the VS Code remote
# container extension when you open the repo in VS Code (a popup will ask you to open the VS Code window again
# inside a the devcontainer)
services:
app:
build:
context: ./.devcontainer
dockerfile: Dockerfile
args:
# [Choice] Node.js version: 16, 14, 12
VARIANT: 16
# On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
#USER_UID: 1000
#USER_GID: 1000
volumes:
- .:/workspace:cached
# - :/workspace/node_modules
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db
depends_on:
- db
env_file:
- .env.devcontainer
# Stock mysql database. Used for both grapher and wordpress databases. Root password is hardcoded for now
db:
image: mysql/mysql-server:latest
command: --default-authentication-plugin=mysql_native_password
restart: always
volumes:
- mysql_data:/var/lib/mysql
ports:
- "3307:3306" # Hardcoded here to 3307 because docker-compose in the VS Code Devcontainer setup is run
# from the users shell on the host OS where the env vars are not yet set
environment:
MYSQL_ROOT_PASSWORD: weeniest-stretch-contaminate-gnarl
MYSQL_ROOT_HOST: "%"
# mysql 8 container with slight augmentation (+curl, +unzip, +ssh client, ...) for running the DB init scripts
# These init scripts check if the grapher and wordpress databases and users are missing, if so they create them
# and pull the data to have a working dev environment.
db-load-data:
build:
context: ./devTools/docker/mysql-init-docker
command: "/app/grapher-only-mysql-init.sh"
volumes:
- ./devTools/docker:/app
- ./tmp-downloads:/tmp-downloads
environment:
DB_ROOT_PASS: weeniest-stretch-contaminate-gnarl
DB_ROOT_HOST: db
DATA_FOLDER: "/tmp-downloads"
env_file:
- .env.devcontainer
depends_on:
- db
volumes:
mysql_data:
try-node-node_modules: