Skip to content

Instantly share code, notes, and snippets.

@wilson29thid
Last active July 5, 2019 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilson29thid/45c758a63b7d9be3a29a96efc00c879a to your computer and use it in GitHub Desktop.
Save wilson29thid/45c758a63b7d9be3a29a96efc00c879a to your computer and use it in GitHub Desktop.
personnel docker
version: '3'
services:
api:
build: ./api
ports:
- "8080:80"
volumes:
- ./api/application:/var/www/html/application
environment:
DB_DEFAULT_DATABASE: personnel_v2
DB_DEFAULT_HOSTNAME: db-personnel
DB_DEFAULT_USERNAME: root
DB_DEFAULT_PASSWORD: pwd
DB_DEFAULT_PORT: 3306
DB_FORUMS_DATABASE: vanilla
DB_FORUMS_HOSTNAME: db-forums
DB_FORUMS_USERNAME: root
DB_FORUMS_PASSWORD: pwd
DB_FORUMS_PORT: 3307
ENCRYPTION_KEY: dev
CORS_HOST: http://localhost:8081
VANILLA_COOKIE_NAME: Vanilla
VANILLA_COOKIE_DOMAIN: http://localhost:8082
VANILLA_COOKIE_PATH: /
VANILLA_COOKIE_HASH_METHOD: md5
VANILLA_COOKIE_SALT: dev
ENVIRONMENT: development
# DIR_COAT_RESOURCES:
# DIR_COAT_PUBLIC:
app:
build: ./app
ports:
- "8081:8080"
command: npm run dev
volumes:
- ./app/src:/home/node/app/src
environment:
BASE_URL: http://localhost:8081
API_HOST: http://localhost:8080
COAT_DIR: http://localhost:8080/coats
FORUM_VANILLA_BASE_URL: http://localhost:8082
FORUM_SMF_BASE_URL: http://29th.org/forums
WIKI_URL: http://29th.org/wiki
db-personnel:
image: mysql:5.6
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
volumes:
- ./db/personnel_v2.sql:/docker-entrypoint-initdb.d/personnel_v2.sql
- db-personnel-persistence:/var/lib/mysql
environment:
MYSQL_DATABASE: personnel_v2
MYSQL_ROOT_PASSWORD: pwd
forums:
build: ./vanilla
ports:
- "8082:80"
volumes:
- ./vanilla/plugins:/var/www/html/plugins
- ./vanilla/themes:/var/www/html/themes
- ./vanilla/uploads:/var/www/html/uploads
environment:
DB_HOSTNAME: db-forums
DB_DATABASE: vanilla
DB_USERNAME: root
DB_PASSWORD: pwd
ENVIRONMENT: development
VANILLA_COOKIE_SALT: dev
APP_URL: http://localhost:8081
db-forums:
image: mysql:5.6
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3307:3306"
volumes:
- ./db/vanilla.sql:/docker-entrypoint-initdb.d/vanilla.sql
- db-forums-persistence:/var/lib/mysql
environment:
MYSQL_DATABASE: vanilla
MYSQL_ROOT_PASSWORD: pwd
volumes:
db-personnel-persistence:
db-forums-persistence:
FROM php:5.5.38-apache
# Install composer (and fix package manager per https://superuser.com/a/1423685)
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends zlib1g-dev \
&& docker-php-ext-install zip
RUN curl --silent --show-error https://getcomposer.org/download/1.8.6/composer.phar > /usr/local/bin/composer \
&& chmod 755 /usr/local/bin/composer
# Configure apache
RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf \
&& a2enmod rewrite
# Enable php mysql extension
RUN docker-php-ext-install mysqli
# Copy application files
COPY . /var/www/html
WORKDIR /var/www/html
# Install application dependencies
RUN composer install --no-plugins --no-scripts
FROM node:8-jessie
USER node
RUN mkdir -p /home/node/app
COPY . /home/node/app
WORKDIR /home/node/app
RUN npm install
FROM php:5.5.38-apache
# Configure apache
RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf \
&& a2enmod rewrite
# Enable php mysql extension
RUN docker-php-ext-install mysqli pdo pdo_mysql
# Copy application files
COPY . /var/www/html
WORKDIR /var/www/html
# Configure vanilla and set file permissions
RUN cp conf/config.sample.php conf/config.php \
&& sed -i conf/config.php \
-e "s,\$Configuration\['Database'\]\['Host'\] = '.*',\$Configuration\['Database'\]\['Host'\] = getenv('DB_HOSTNAME')," \
-e "s,\$Configuration\['Database'\]\['Name'\] = '.*',\$Configuration\['Database'\]\['Name'\] = getenv('DB_DATABASE')," \
-e "s,\$Configuration\['Database'\]\['User'\] = '.*',\$Configuration\['Database'\]\['User'\] = getenv('DB_USERNAME')," \
-e "s,\$Configuration\['Database'\]\['Password'\] = '.*',\$Configuration\['Database'\]\['Password'\] = getenv('DB_PASSWORD')," \
-e "s,\$Configuration\['Debug'\] = FALSE,\$Configuration\['Debug'\] = getenv('ENVIRONMENT') == 'development'," \
-e "s,\$Configuration\['Garden'\]\['Cookie'\]\['Salt'\] = '.*',\$Configuration\['Garden'\]\['Cookie'\]\['Salt'\] = getenv('VANILLA_COOKIE_SALT')," \
-e "s,\$Configuration\['Garden'\]\['Installed'\] = FALSE,\$Configuration\['Garden'\]\['Installed'\] = TRUE," \
&& chmod -R 777 conf cache uploads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment