ensl.org/docker-compose.yml
Ari Timonen 4513bc9f84 Fix env vars issues
Dockerfile clean up + comments
entry.sh more env vars
Fix env* rbs
Comment out SSL for now in nginx
Doc updates
2020-04-06 03:31:05 +03:00

139 lines
No EOL
3.2 KiB
YAML

version: "3.4"
services:
#
# Main service
#
web:
# For debug; Use attach rather than this
# command: /bin/bash
command: "bundle exec puma"
tty: true
stdin_open: true
container_name: "ensl_${RAILS_ENV}"
user: "web:web"
build:
context: ./
dockerfile: Dockerfile
target: ensl_${RAILS_ENV}
volumes:
- ".:/var/www/"
environment:
RAILS_ENV: $RAILS_ENV
ports:
- "${PUMA_PORT}:${PUMA_PORT}"
- "35729:35729"
links:
- db
- memcached
- smtp
#- spring
#- redis
nginx:
image: nginx:latest
container_name: ensl_${RAILS_ENV}_nginx
command: /bin/bash -c "envsubst '$$PUMA_PORT' < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
volumes:
- ./ext/ssl/fullchain.pem:/etc/ssl/certs/ensl_fullchain.pem
- ./ext/ssl/privkey.pem:/etc/ssl/private/ensl_privkey.pem
- ./ext/nginx.conf.d/:/etc/nginx/conf.d/
- ./public:/var/www/public
#ports:
# - $APP_PORT:80
# - $APP_PORT_SSL:443
environment:
- APP_DOMAIN=$APP_DOMAIN
- APP_PORT=$APP_PORT
- PUMA_PORT=$PUMA_PORT
- RAILS_ENV=$RAILS_ENV
#
# Testing
#
# Seperate test container so dev / test don't cause problems
test:
command: ["bash", "-c", "while true; do sleep 100; done;"]
container_name: ensl_test
build:
context: ./
dockerfile: Dockerfile
target: ensl_development
env_file:
- .env.test
ports:
- ${TEST_APP_PORT}:${TEST_APP_PORT} # Capybara listens here
links:
- db
- memcached
- selenium
volumes:
- ".:/var/www"
# command: bin/spring server
environment:
RAILS_ENV: test
networks:
default:
aliases:
- test
selenium:
image: selenium/standalone-chrome-debug
container_name: ensl_selenium
ports:
- 5900:5900
- 4444:4444
#
# Common services: These are shared by all envs.
#
memcached:
image: memcached:alpine
container_name: ensl_memcached
redis:
image: 'redis:4.0-alpine'
container_name: ensl_redis
db:
image: mariadb:latest
container_name: ensl_db
user: "mysql:mysql"
# debug; command: mysqld_safe --skip-grant-tables
volumes:
- "./db/data:/var/lib/mysql"
- "./db/initdb.d:/docker-entrypoint-initdb.d"
- "./ext/mysql.conf.d:/etc/mysql/conf.d"
environment:
- MYSQL_DATABASE=$MYSQL_DATABASE
- MYSQL_USER=$MYSQL_USER
- MYSQL_PASSWORD=$MYSQL_PASSWORD
- MYSQL_ROOT_PASSWORD=$MYSQL_PASSWORD
- MYSQL_ROOT_HOST=$MYSQL_ROOT_HOST
smtp:
image: mwader/postfix-relay:latest
container_name: ensl_smtp
restart: always
volumes:
- "./ext/dkim:/etc/opendkim/keys"
environment:
- POSTFIX_myhostname=$APP_DOMAIN
- OPENDKIM_DOMAINS=$APP_DOMAIN
# spring:
# build:
# context: ./
# dockerfile: Dockerfile.dev
# args:
# buildno: 1
# volumes:
# - .:/var/www
# command: spring server
# This ensures that the pid namespace is shared between the host
# and the container. It's not necessary to be able to run spring
# commands, but it is necessary for "spring status" and "spring stop"
# to work properly.
# pid: host