aboutsummaryrefslogtreecommitdiff
path: root/.devcontainer/docker-compose.yml
blob: 447dadcfe93b6333df9ef8b8dab2a178960dcf46 (plain) (blame)
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
version: '3'

services:
  pantry:
    build: 
      context: .
      dockerfile: Dockerfile
      args:
        # Volume directory for hosted files. This directory is created on image build with proper permissions. This is set as an env-var in the Dockerfile
        VARIANT: "11"

        # Options
        INSTALL_MAVEN: "true"
        INSTALL_GRADLE: "false"
        NODE_VERSION: "lts/*"

    environment:
      MARIADB_HOST: "pantry-db"

    volumes:
      - ..:/workspaces/pantry:cached

    # 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:pantry-db

    # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. 
    # (Adding the "ports" property to this file will not forward from a Codespace.)

  pantry-db:
    image: mariadb:10.7
    restart: unless-stopped
    volumes:
      - pantrydb-data:/var/lib/mysql
      
    environment:
      MARIADB_RANDOM_ROOT_PASSWORD: "true"
      MARIADB_DATABASE: "pantry-db"
      MARIADB_USER: "pantry-user"
      MARIADB_PASSWORD: "i2j9ds0g"

    # Add "forwardPorts": ["27017"] to **devcontainer.json** to forward MongoDB locally.
    # (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
  pantrydb-data: