Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOTICKET - cleanup dockerfile formatting and typos #284

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 93 additions & 82 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ ENV LUAJIT_INC=/usr/include/luajit-2.1
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv


# INstall nginx + lua and devel kit
# Install nginx + lua and devel kit
RUN apk add --no-cache nginx \
nginx-mod-http-lua \
nginx-mod-devel-kit
nginx-mod-http-lua \
nginx-mod-devel-kit

RUN echo @testing https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
echo /etc/apk/respositories && \
apk update && apk upgrade &&\
apk add --no-cache \
RUN echo @testing https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& echo /etc/apk/repositories \
&& apk update && apk upgrade \
&& apk add --no-cache \
bash \
openssh-client \
wget \
Expand All @@ -47,48 +46,58 @@ RUN echo @testing https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk
gcc

RUN apk add --no-cache --virtual .sys-deps \
musl-dev \
linux-headers \
augeas-dev \
libmcrypt-dev \
python3-dev \
libffi-dev \
sqlite-dev \
imap-dev \
postgresql-dev \
lua-resty-core \
libjpeg-turbo-dev \
libwebp-dev \
zlib-dev \
libxpm-dev \
libpng \
libpng-dev && \
musl-dev \
linux-headers \
augeas-dev \
libmcrypt-dev \
python3-dev \
libffi-dev \
sqlite-dev \
imap-dev \
postgresql-dev \
lua-resty-core \
libjpeg-turbo-dev \
libwebp-dev \
zlib-dev \
libxpm-dev \
libpng \
libpng-dev \
# Install PHP modules
docker-php-ext-configure gd \
--enable-gd \
--with-freetype \
--with-jpeg && \
docker-php-ext-install gd && \
pip install --upgrade pip && \
docker-php-ext-install pdo_mysql mysqli pdo_sqlite pgsql pdo_pgsql exif intl xsl soap zip && \
pecl install -o -f xdebug && \
pecl install -o -f redis && \
pecl install -o -f mongodb && \
echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini && \
echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongodb.ini && \
echo "zend_extension=xdebug" > /usr/local/etc/php/conf.d/xdebug.ini && \
docker-php-source delete && \
mkdir -p /var/www/app && \
&& docker-php-ext-configure gd \
--enable-gd \
--with-freetype \
--with-jpeg \
&& docker-php-ext-install gd \
&& pip install --upgrade pip \
&& docker-php-ext-install \
pdo_mysql \
mysqli \
pdo_sqlite \
pgsql \
pdo_pgsql \
exif \
intl \
xsl \
soap \
zip \
&& pecl install -o -f xdebug \
&& pecl install -o -f redis \
&& pecl install -o -f mongodb \
&& echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini \
&& echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongodb.ini \
&& echo "zend_extension=xdebug" > /usr/local/etc/php/conf.d/xdebug.ini \
&& docker-php-source delete \
&& mkdir -p /var/www/app \
# Install composer and certbot
mkdir -p /var/log/supervisor && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php composer-setup.php --quiet --install-dir=/usr/bin --filename=composer && \
rm composer-setup.php &&\
# pip3 install -U pip && \
pip3 install -U certbot && \
mkdir -p /etc/letsencrypt/webrootauth && \
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python3-dev make autoconf && \
apk del .sys-deps
&& mkdir -p /var/log/supervisor \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --quiet --install-dir=/usr/bin --filename=composer \
&& rm composer-setup.php \
&& pip3 install -U certbot \
&& mkdir -p /etc/letsencrypt/webrootauth \
# Cleanup dependencies
&& apk del gcc musl-dev linux-headers libffi-dev augeas-dev python3-dev make autoconf \
&& apk del .sys-deps

ADD conf/supervisord.conf /etc/supervisord.conf

Expand All @@ -97,57 +106,59 @@ RUN rm -Rf /etc/nginx/nginx.conf
ADD conf/nginx.conf /etc/nginx/nginx.conf

# nginx site conf
RUN mkdir -p /etc/nginx/sites-available/ && \
mkdir -p /etc/nginx/sites-enabled/ && \
mkdir -p /etc/nginx/ssl/ && \
rm -Rf /var/www/* && \
mkdir /var/www/html/
RUN mkdir -p /etc/nginx/sites-available/ \
&& mkdir -p /etc/nginx/sites-enabled/ \
&& mkdir -p /etc/nginx/ssl/ \
&& rm -Rf /var/www/* \
&& mkdir /var/www/html/
ADD conf/nginx-site.conf /etc/nginx/sites-available/default.conf
ADD conf/nginx-site-ssl.conf /etc/nginx/sites-available/default-ssl.conf
RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf

# tweak php-fpm config
RUN echo "cgi.fix_pathinfo=0" > ${php_vars} &&\
echo "upload_max_filesize = 100M" >> ${php_vars} &&\
echo "post_max_size = 100M" >> ${php_vars} &&\
echo "variables_order = \"EGPCS\"" >> ${php_vars} && \
echo "memory_limit = 128M" >> ${php_vars} && \
sed -i \
-e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" \
-e "s/pm.max_children = 5/pm.max_children = 4/g" \
-e "s/pm.start_servers = 2/pm.start_servers = 3/g" \
-e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" \
-e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" \
-e "s/;pm.max_requests = 500/pm.max_requests = 200/g" \
-e "s/user = www-data/user = nginx/g" \
-e "s/group = www-data/group = nginx/g" \
-e "s/;listen.mode = 0660/listen.mode = 0666/g" \
-e "s/;listen.owner = www-data/listen.owner = nginx/g" \
-e "s/;listen.group = www-data/listen.group = nginx/g" \
-e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" \
-e "s/^;clear_env = no$/clear_env = no/" \
${fpm_conf}
# ln -s /etc/php7/php.ini /etc/php7/conf.d/php.ini && \
RUN cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini && \
sed -i \
-e "s/;opcache/opcache/g" \
-e "s/;zend_extension=opcache/zend_extension=opcache/g" \
/usr/local/etc/php/php.ini

RUN echo "cgi.fix_pathinfo=0" > ${php_vars} \
&& echo "upload_max_filesize = 100M" >> ${php_vars} \
&& echo "post_max_size = 100M" >> ${php_vars} \
&& echo "variables_order = \"EGPCS\"" >> ${php_vars} \
&& echo "memory_limit = 128M" >> ${php_vars} \
&& sed -i \
-e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" \
-e "s/pm.max_children = 5/pm.max_children = 4/g" \
-e "s/pm.start_servers = 2/pm.start_servers = 3/g" \
-e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" \
-e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" \
-e "s/;pm.max_requests = 500/pm.max_requests = 200/g" \
-e "s/user = www-data/user = nginx/g" \
-e "s/group = www-data/group = nginx/g" \
-e "s/;listen.mode = 0660/listen.mode = 0666/g" \
-e "s/;listen.owner = www-data/listen.owner = nginx/g" \
-e "s/;listen.group = www-data/listen.group = nginx/g" \
-e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" \
-e "s/^;clear_env = no$/clear_env = no/" \
${fpm_conf}

RUN cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini \
&& sed -i \
-e "s/;opcache/opcache/g" \
-e "s/;zend_extension=opcache/zend_extension=opcache/g" \
/usr/local/etc/php/php.ini

# Add Scripts
ADD scripts/start.sh /start.sh
ADD scripts/pull /usr/bin/pull
ADD scripts/push /usr/bin/push
ADD scripts/letsencrypt-setup /usr/bin/letsencrypt-setup
ADD scripts/letsencrypt-renew /usr/bin/letsencrypt-renew
RUN chmod 755 /usr/bin/pull && chmod 755 /usr/bin/push && chmod 755 /usr/bin/letsencrypt-setup && chmod 755 /usr/bin/letsencrypt-renew && chmod 755 /start.sh
RUN chmod 755 /usr/bin/pull \
&& chmod 755 /usr/bin/push \
&& chmod 755 /usr/bin/letsencrypt-setup \
&& chmod 755 /usr/bin/letsencrypt-renew \
&& chmod 755 /start.sh

# copy in code
ADD src/ /var/www/html/
ADD errors/ /var/www/errors


EXPOSE 443 80

WORKDIR "/var/www/html"
Expand Down