Skip to content

Instantly share code, notes, and snippets.

@mashiox
Created September 5, 2019 16:36
Show Gist options
  • Save mashiox/089ae5699875536633d14609794dd67f to your computer and use it in GitHub Desktop.
Save mashiox/089ae5699875536633d14609794dd67f to your computer and use it in GitHub Desktop.
OpenTHC Menu Docker reference
version: '3.2'
services:
menu:
image: openthc/menu-app:latest
environment:
- APP_ROOT=/opt/menu.openthc.com
- APACHE_SERVER_NAME=localhost
- APACHE_DOCUMENT_ROOT="/opt/menu.openthc.com/webroot"
- APP_SITE=http://localhost:8000
volumes:
- ../bin:/opt/menu.openthc.com/bin
- ../controller:/opt/menu.openthc.com/controller
- ../lib:/opt/menu.openthc.com/lib
- ../theme:/opt/menu.openthc.com/theme
- ../twig:/opt/menu.openthc.com/twig
- ../webroot:/opt/menu.openthc.com/webroot
- ../boot.php:/opt/menu.openthc.com/boot.php
- ../composer.json:/opt/menu.openthc.com/composer.json
ports:
- "8000:80"
command: "apache2-foreground"
postgres:
image: openthc/postgres-base:latest
ports:
- "54321:5432"
environment:
- POSTGRES_PASSWORD=openthc
- POSTGRES_USER=openthc
- POSTGRES_DB=openthc
redis:
image: redis:latest
FROM openthc/openthc-base:latest
ENV APP_NAME=OpenTHC
ENV APP_ROOT=/opt/menu.openthc.com
ENV APACHE_DOCUMENT_ROOT=${APP_ROOT}/webroot
ENV APACHE_SERVER_NAME=localhost
ENV APACHE_PORT=8000
# Problematic at build time...
ENV APP_SITE=http://${APACHE_SERVER_NAME}:${APACHE_PORT}
COPY build/config/apache2/menu.openthc.com.conf /etc/apache2/sites-enabled/
WORKDIR ${APP_ROOT}
ADD --chown=www-data:www-data ./bin bin
ADD --chown=www-data:www-data ./controller controller
ADD --chown=www-data:www-data ./lib lib
ADD --chown=www-data:www-data ./twig twig
ADD --chown=www-data:www-data ./view view
ADD --chown=www-data:www-data ./webroot webroot
COPY --chown=www-data:www-data ./boot.php boot.php
COPY --chown=www-data:www-data ./composer.json composer.json
COPY --chown=www-data:www-data build/config/etc etc
ADD ./build/vendor-cache.tar.gz /opt/cache
RUN mv /opt/cache/vendor vendor
RUN mkdir -p $HOME/.composer \
&& chown -R www-data:www-data ./vendor
EXPOSE 80
FROM php:7.2-apache
RUN apt-get update \
&& apt-get install -y \
git \
vim \
curl \
zip \
sqlite3 \
libpng-dev \
libssl-dev libcurl4-openssl-dev pkg-config \
libldb-dev libldap2-dev \
libpq-dev \
libedit-dev \
libxml2-dev \
libc-client-dev \
libkrb5-dev \
libjpeg-dev \
libfreetype6-dev \
libwebp-dev \
libxpm-dev
RUN ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \
&& ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap
RUN docker-php-ext-configure gd \
--with-gd \
--with-png-dir \
--with-zlib-dir \
--with-webp-dir \
--with-xpm-dir \
--with-freetype-dir=/usr/include \
--with-jpeg-dir=/usr/include \
--enable-gd-native-ttf
RUN docker-php-ext-install -j$(nproc) \
bcmath \
calendar \
curl \
gd \
json \
ldap \
pdo \
pdo_pgsql \
opcache \
readline \
pgsql \
xml \
xmlrpc \
mbstring \
zip \
dba \
sockets
RUN pecl install -o redis \
&& docker-php-ext-enable redis opcache
RUN a2enmod rewrite unique_id \
&& a2dissite 000-default
all: base app
base:
docker build --rm -t openthc/openthc-base -f ./Dockerfile.base ..
app:
docker build --rm -t openthc/menu-app -f ./Dockerfile ..
clean:
@echo "Cleaning Menu Images"
-docker rmi `docker images -qq openthc/openthc-*`
-docker rmi `docker images -qq openthc/menu-*`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment