2021-09-13 15:24:30 -07:00
|
|
|
FROM ubuntu:focal
|
|
|
|
LABEL maintainer Brady Wetherington <bwetherington@grokability.com>
|
2018-12-17 15:29:05 -08:00
|
|
|
|
2021-03-17 20:33:54 -07:00
|
|
|
# No need to add `apt-get clean` here, reference:
|
|
|
|
# - https://github.com/snipe/snipe-it/pull/9201
|
|
|
|
# - https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get
|
|
|
|
|
2018-12-17 15:29:05 -08:00
|
|
|
RUN export DEBIAN_FRONTEND=noninteractive; \
|
|
|
|
export DEBCONF_NONINTERACTIVE_SEEN=true; \
|
|
|
|
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
|
|
|
|
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
|
|
|
|
apt-get update -qqy \
|
|
|
|
&& apt-get install -qqy --no-install-recommends \
|
|
|
|
apt-utils \
|
2017-06-01 20:53:01 -07:00
|
|
|
apache2 \
|
2016-03-25 01:18:05 -07:00
|
|
|
apache2-bin \
|
2021-09-13 15:24:30 -07:00
|
|
|
libapache2-mod-php7.4 \
|
|
|
|
php7.4-curl \
|
|
|
|
php7.4-ldap \
|
|
|
|
php7.4-mysql \
|
|
|
|
php7.4-gd \
|
|
|
|
php7.4-xml \
|
|
|
|
php7.4-mbstring \
|
|
|
|
php7.4-zip \
|
|
|
|
php7.4-bcmath \
|
2016-03-25 01:18:05 -07:00
|
|
|
patch \
|
|
|
|
curl \
|
2018-12-17 15:29:05 -08:00
|
|
|
wget \
|
2016-03-25 01:18:05 -07:00
|
|
|
vim \
|
2016-05-14 15:43:46 -07:00
|
|
|
git \
|
2018-06-20 23:28:35 -07:00
|
|
|
cron \
|
2017-03-31 15:43:37 -07:00
|
|
|
mysql-client \
|
2019-03-07 12:42:00 -08:00
|
|
|
supervisor \
|
2018-07-23 20:40:04 -07:00
|
|
|
cron \
|
2018-12-17 15:29:05 -08:00
|
|
|
gcc \
|
|
|
|
make \
|
|
|
|
autoconf \
|
|
|
|
libc-dev \
|
|
|
|
pkg-config \
|
|
|
|
libmcrypt-dev \
|
2021-09-13 15:24:30 -07:00
|
|
|
php7.4-dev \
|
2019-01-25 13:41:39 -08:00
|
|
|
ca-certificates \
|
|
|
|
unzip \
|
2017-03-31 15:43:37 -07:00
|
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2018-12-17 15:29:05 -08:00
|
|
|
|
2019-01-25 13:41:39 -08:00
|
|
|
RUN curl -L -O https://github.com/pear/pearweb_phars/raw/master/go-pear.phar
|
2018-12-17 15:29:05 -08:00
|
|
|
RUN php go-pear.phar
|
|
|
|
|
2021-09-13 15:24:30 -07:00
|
|
|
RUN pecl install mcrypt-1.0.3
|
2018-12-17 15:29:05 -08:00
|
|
|
|
2021-09-13 15:24:30 -07:00
|
|
|
RUN bash -c "echo extension=/usr/lib/php/20190902/mcrypt.so > /etc/php/7.4/mods-available/mcrypt.ini"
|
2018-12-17 15:29:05 -08:00
|
|
|
|
2017-06-01 20:53:01 -07:00
|
|
|
RUN phpenmod mcrypt
|
|
|
|
RUN phpenmod gd
|
2017-08-16 13:10:25 -07:00
|
|
|
RUN phpenmod bcmath
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-09-13 15:24:30 -07:00
|
|
|
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.4/apache2/php.ini
|
|
|
|
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.4/cli/php.ini
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2017-06-01 20:53:01 -07:00
|
|
|
RUN useradd -m --uid 1000 --gid 50 docker
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
RUN echo export APACHE_RUN_USER=docker >> /etc/apache2/envvars
|
|
|
|
RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvars
|
|
|
|
|
|
|
|
COPY docker/000-default.conf /etc/apache2/sites-enabled/000-default.conf
|
|
|
|
|
|
|
|
#SSL
|
2016-05-14 15:43:46 -07:00
|
|
|
RUN mkdir -p /var/lib/snipeit/ssl
|
2019-01-25 13:41:39 -08:00
|
|
|
#COPY docker/001-default-ssl.conf /etc/apache2/sites-enabled/001-default-ssl.conf
|
|
|
|
COPY docker/001-default-ssl.conf /etc/apache2/sites-available/001-default-ssl.conf
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
RUN a2enmod ssl
|
2019-01-25 13:41:39 -08:00
|
|
|
RUN a2ensite 001-default-ssl.conf
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-04-06 05:05:16 -07:00
|
|
|
COPY . /var/www/html
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
RUN a2enmod rewrite
|
|
|
|
|
|
|
|
############ INITIAL APPLICATION SETUP #####################
|
|
|
|
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
|
|
|
|
#Append to bootstrap file (less brittle than 'patch')
|
2016-05-14 15:43:46 -07:00
|
|
|
# RUN sed -i 's/return $app;/$env="production";\nreturn $app;/' bootstrap/start.php
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
#copy all configuration files
|
2016-05-14 15:43:46 -07:00
|
|
|
# COPY docker/*.php /var/www/html/app/config/production/
|
2021-04-06 05:05:16 -07:00
|
|
|
COPY docker/docker.env /var/www/html/.env
|
|
|
|
|
|
|
|
RUN chown -R docker /var/www/html
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2016-05-14 15:43:46 -07:00
|
|
|
RUN \
|
2016-11-11 20:30:04 -08:00
|
|
|
rm -r "/var/www/html/storage/private_uploads" && ln -fs "/var/lib/snipeit/data/private_uploads" "/var/www/html/storage/private_uploads" \
|
|
|
|
&& rm -rf "/var/www/html/public/uploads" && ln -fs "/var/lib/snipeit/data/uploads" "/var/www/html/public/uploads" \
|
2018-04-16 16:29:42 -07:00
|
|
|
&& rm -r "/var/www/html/storage/app/backups" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/storage/app/backups" \
|
2019-01-25 13:41:39 -08:00
|
|
|
&& mkdir -p "/var/lib/snipeit/keys" && ln -fs "/var/lib/snipeit/keys/oauth-private.key" "/var/www/html/storage/oauth-private.key" \
|
2018-04-16 16:29:42 -07:00
|
|
|
&& ln -fs "/var/lib/snipeit/keys/oauth-public.key" "/var/www/html/storage/oauth-public.key" \
|
2019-03-07 12:42:00 -08:00
|
|
|
&& chown docker "/var/lib/snipeit/keys/" \
|
2021-04-06 06:09:04 -07:00
|
|
|
&& chown -h docker "/var/www/html/storage/" \
|
2019-03-07 12:42:00 -08:00
|
|
|
&& chmod +x /var/www/html/artisan \
|
|
|
|
&& echo "Finished setting up application in /var/www/html"
|
2016-05-14 15:43:46 -07:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
############## DEPENDENCIES via COMPOSER ###################
|
|
|
|
|
|
|
|
#global install of composer
|
2018-12-17 15:29:05 -08:00
|
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
# Get dependencies
|
2017-06-01 20:53:01 -07:00
|
|
|
USER docker
|
2018-12-17 15:29:05 -08:00
|
|
|
RUN composer install --no-dev --working-dir=/var/www/html
|
2017-06-01 20:53:01 -07:00
|
|
|
USER root
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
############### APPLICATION INSTALL/INIT #################
|
|
|
|
|
|
|
|
#RUN php artisan app:install
|
|
|
|
# too interactive! Try something else
|
|
|
|
|
|
|
|
#COPY docker/app_install.exp /tmp/app_install.exp
|
|
|
|
#RUN chmod +x /tmp/app_install.exp
|
|
|
|
#RUN /tmp/app_install.exp
|
|
|
|
|
2016-05-14 15:43:46 -07:00
|
|
|
############### DATA VOLUME #################
|
|
|
|
|
2016-08-30 12:13:29 -07:00
|
|
|
VOLUME ["/var/lib/snipeit"]
|
2016-05-14 15:43:46 -07:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
##### START SERVER
|
|
|
|
|
2019-03-07 12:42:00 -08:00
|
|
|
COPY docker/startup.sh docker/supervisord.conf /
|
|
|
|
COPY docker/supervisor-exit-event-listener /usr/bin/supervisor-exit-event-listener
|
|
|
|
RUN chmod +x /startup.sh /usr/bin/supervisor-exit-event-listener
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2019-03-07 12:42:00 -08:00
|
|
|
CMD ["/startup.sh"]
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
EXPOSE 443
|