uccser/cs-field-guide

View on GitHub
docker-compose.local.yml

Summary

Maintainability
Test Coverage
version: "3.8"

services:
    django:
        build:
            context: .
            dockerfile: ./infrastructure/local/django/Dockerfile
        image: cs_field_guide_local_django
        volumes:
            - ./csfieldguide/:/app/:z
            - ./infrastructure/local/node/Dockerfile:/test_files/Dockerfile:z
            - ./docker-compose.local.yml:/test_files/docker-compose.local.yml:z
        env_file:
            - ./infrastructure/local/django/.envs
            - ./infrastructure/local/postgres/.envs
        command: /start
        networks:
            - uccser-development-stack
            - backend
        labels:
            # General labels
            - "traefik.enable=true"
            - "traefik.docker.network=uccser-development-stack"
            - "traefik.http.services.cs-field-guide-django.loadbalancer.server.port=8000"
            # HTTPS
            - "traefik.http.routers.cs-field-guide-django.entryPoints=web-secure"
            - "traefik.http.routers.cs-field-guide-django.service=cs-field-guide-django"
            - "traefik.http.routers.cs-field-guide-django.rule=Host(`cs-field-guide.localhost`)"
            - "traefik.http.routers.cs-field-guide-django.tls=true"

    # Node server for creating static files
    node:
        build:
            context: .
            dockerfile: ./infrastructure/local/node/Dockerfile
            args:
                DOCKER_UID: ${DOCKER_UID}
        image: cs_field_guide_local_node
        volumes:
            # https://burnedikt.com/dockerized-node-development-and-mounting-node-volumes/#exclude-node_modules-from-the-mount
            - ./csfieldguide/package.json:/app/package.json:z
            - ./csfieldguide/package-lock.json:/app/package-lock.json:z
            - ./csfieldguide/gulpfile.mjs:/app/gulpfile.mjs:z
            - ./csfieldguide/static:/app/static:z
            - ./csfieldguide/build:/app/build:z
            - /app/static/interactives/algorithm-timer/node_modules/
            - /app/static/interactives/big-number-calculator/node_modules/
            - /app/static/interactives/bin-packing/node_modules/
            - /app/static/js/translation-rotation-interactives/node_modules/
            - /app/static/interactives/caesar-cipher/node_modules/
            - /app/static/interactives/city-trip/node_modules/
            - /app/static/interactives/cmy-mixer/node_modules/
            - /app/static/interactives/colour-matcher/node_modules/
            - /app/static/interactives/data-bias/node_modules/
            - /app/static/interactives/data-visualisation/node_modules/
            - /app/static/interactives/frequency-analysis/node_modules/
            - /app/static/interactives/jpeg-compression/node_modules/
            - /app/static/interactives/matrix-simplifier/node_modules/
            - /app/static/interactives/packet-attack/node_modules/
            - /app/static/interactives/password-guesser/node_modules/
            - /app/static/interactives/product-code-check-digit-calculation/node_modules/
            - /app/static/interactives/python-interpreter/node_modules/
            - /app/static/interactives/qr-code-generator/node_modules/
            - /app/static/interactives/rgb-mixer/node_modules/
            - /app/static/interactives/rsa-decryption/node_modules/
            - /app/static/interactives/rsa-encryption/node_modules/
            - /app/static/interactives/rsa-key-generator/node_modules/
            - /app/static/interactives/scene-editor/node_modules/
            - /app/static/interactives/sha2/node_modules/
            - /app/static/interactives/shannon-experiment/node_modules/
            - /app/static/interactives/sorting-algorithms/node_modules/
            - /app/static/interactives/training-ground/node_modules/
            - /app/static/interactives/unicode-binary/node_modules/
            - /app/static/interactives/unicode-chars/node_modules/
            - /app/static/interactives/viola-jones-face-detector/node_modules/
        command: npm run dev
        networks:
            - backend

    puppeteer:
        image: buildkite/puppeteer:10.0.0
        volumes:
            - ./csfieldguide/make-interactive-thumbnails.js:/make-interactive-thumbnails.js:z
            - ./csfieldguide/staticfiles:/staticfiles:z
            - ./csfieldguide/build:/build:z
        profiles:
            - static-files
        networks:
            - backend

    postgres:
        image: postgres:13.8
        healthcheck:
            test: ["CMD-SHELL", "pg_isready -U postgres"]
            start_period: 10s
            interval: 10s
            timeout: 5s
            retries: 3
        env_file:
            - ./infrastructure/local/postgres/.envs
        networks:
            - backend

    docs:
        image: ghcr.io/uccser/local-docs-image:latest
        volumes:
            - ./docs:/docs:z
        networks:
            - uccser-development-stack
        labels:
            # General labels
            - "traefik.enable=true"
            - "traefik.http.services.cs-field-guide-docs.loadbalancer.server.port=7000"
            # HTTPS
            - "traefik.http.routers.cs-field-guide-docs.entryPoints=web-secure"
            - "traefik.http.routers.cs-field-guide-docs.service=cs-field-guide-docs"
            - "traefik.http.routers.cs-field-guide-docs.rule=Host(`docs.cs-field-guide.localhost`)"
            - "traefik.http.routers.cs-field-guide-docs.tls=true"

networks:
    backend:
        driver: bridge
    uccser-development-stack:
        external: true