Skip to content

Instantly share code, notes, and snippets.

@jwill9999
Last active October 25, 2018 21:52
Show Gist options
  • Select an option

  • Save jwill9999/2786631eeb85ce7c2ebde3b4c585434c to your computer and use it in GitHub Desktop.

Select an option

Save jwill9999/2786631eeb85ce7c2ebde3b4c585434c to your computer and use it in GitHub Desktop.
docker in production and testing

Instructions

Files below are an example of Development to production including CI testing

Dev

docker-compose up -d

This will use the docker-compose.yml file Plus the docker-compose-override.yml to run the container

CI solution

docker-compose -f docker-compose.yml -f docker-compose.test.yml up -d

Production

docker-compose -f docker-compose.yml -f docker-compose.production.yml config > final-production.yml

Deploy

docker stack deploy [OPTIONS] STACK

version: '3.1'
services:
drupal:
build: .
ports:
- "8080:80"
volumes:
- drupal-modules:/var/www/html/modules
- drupal-profiles:/var/www/html/profiles
- drupal-sites:/var/www/html/sites
- ./themes:/var/www/html/themes
postgres:
environment:
- POSTGRES_PASSWORD_FILE=/run/secrets/psql-pw
secrets:
- psql-pw
volumes:
- drupal-data:/var/lib/postgresql/data
volumes:
drupal-data:
drupal-modules:
drupal-profiles:
drupal-sites:
drupal-themes:
secrets:
psql-pw:
file: psql-fake-password.txt
version: '3.1'
services:
drupal:
ports:
- "80:80"
volumes:
- drupal-modules:/var/www/html/modules
- drupal-profiles:/var/www/html/profiles
- drupal-sites:/var/www/html/sites
- drupal-themes:/var/www/html/themes
postgres:
environment:
- POSTGRES_PASSWORD_FILE=/run/secrets/psql-pw
secrets:
- psql-pw
volumes:
- drupal-data:/var/lib/postgresql/data
volumes:
drupal-data:
drupal-modules:
drupal-profiles:
drupal-sites:
drupal-themes:
secrets:
psql-pw:
external: true
version: '3.1'
services:
drupal:
image: custom-drupal
build: .
ports:
- "80:80"
postgres:
environment:
- POSTGRES_PASSWORD_FILE=/run/secrets/psql-pw
secrets:
- psql-pw
volumes:
- ./sample-data:/var/lib/postgresql/data
secrets:
psql-pw:
file: psql-fake-password.txt
version: '3.1'
services:
drupal:
image: custom-drupal:latest
postgres:
image: postgres:9.6
FROM drupal:8.5
RUN apt-get update && apt-get install -y git \
&& rm -rf /var/lib/apt/lists/*
# this next part was corrected in 2018 to be more clear on how you'd typically
# customize your own theme. first you need to clone the theme into this repo
# with something like downloading the lastest theme for bootstrap
# https://www.drupal.org/project/bootstrap and extract into themes dir on host.
# then you'll COPY it into image here:
WORKDIR /var/www/html/core
COPY ./themes ./themes
WORKDIR /var/www/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment