snipe-it/Dockerfile

110 lines
3.1 KiB
Docker
Raw Normal View History

2017-06-01 20:53:01 -07:00
FROM ubuntu:xenial
2016-03-25 01:18:05 -07:00
MAINTAINER Brady Wetherington <uberbrady@gmail.com>
RUN apt-get update && apt-get install -y \
2017-06-01 20:53:01 -07:00
apache2 \
2016-03-25 01:18:05 -07:00
apache2-bin \
2017-06-01 20:53:01 -07:00
libapache2-mod-php7.0 \
php7.0-curl \
php7.0-ldap \
php7.0-mysql \
php7.0-mcrypt \
php7.0-gd \
php7.0-xml \
php7.0-mbstring \
php7.0-zip \
php7.0-bcmath \
2016-03-25 01:18:05 -07:00
patch \
curl \
vim \
2016-05-14 15:43:46 -07:00
git \
mysql-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2016-03-25 01:18:05 -07:00
2017-06-01 20:53:01 -07:00
RUN phpenmod mcrypt
RUN phpenmod gd
RUN phpenmod bcmath
2016-03-25 01:18:05 -07:00
2017-06-01 20:53:01 -07:00
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.0/apache2/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.0/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
2016-03-25 01:18:05 -07: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
RUN a2enmod ssl
#RUN a2ensite 001-default-ssl.conf
COPY . /var/www/html
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/
COPY docker/docker.env /var/www/html/.env
2016-03-25 01:18:05 -07:00
RUN chown -R docker /var/www/html
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" \
&& rm -r "/var/www/html/storage/app/backups" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/storage/app/backups" \
&& mkdir "/var/lib/snipeit/keys" && ln -fs "/var/lib/snipeit/keys/oauth-private.key" "/var/www/html/storage/oauth-private.key" \
&& ln -fs "/var/lib/snipeit/keys/oauth-public.key" "/var/www/html/storage/oauth-public.key" \
&& chown docker "/var/lib/snipeit/keys/"
2016-05-14 15:43:46 -07:00
2016-03-25 01:18:05 -07:00
############## DEPENDENCIES via COMPOSER ###################
#global install of composer
RUN cd /tmp;curl -sS https://getcomposer.org/installer | php;mv /tmp/composer.phar /usr/local/bin/composer
# Get dependencies
2017-06-01 20:53:01 -07:00
USER docker
RUN cd /var/www/html;composer install && rm -rf /home/docker/.composer/cache
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
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
2017-06-01 20:53:01 -07:00
# Add Tini
ENV TINI_VERSION v0.14.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
CMD ["/entrypoint.sh"]
2016-03-25 01:18:05 -07:00
EXPOSE 80
EXPOSE 443