mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
5e06d53d8c
Awesome, thanks!
134 lines
3.7 KiB
Docker
134 lines
3.7 KiB
Docker
FROM ubuntu:bionic
|
|
LABEL maintainer Brady Wetherington <uberbrady@gmail.com>
|
|
|
|
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 \
|
|
apache2 \
|
|
apache2-bin \
|
|
libapache2-mod-php7.2 \
|
|
php7.2-curl \
|
|
php7.2-ldap \
|
|
php7.2-mysql \
|
|
php7.2-gd \
|
|
php7.2-xml \
|
|
php7.2-mbstring \
|
|
php7.2-zip \
|
|
php7.2-bcmath \
|
|
patch \
|
|
curl \
|
|
wget \
|
|
vim \
|
|
git \
|
|
cron \
|
|
mysql-client \
|
|
cron \
|
|
gcc \
|
|
make \
|
|
autoconf \
|
|
libc-dev \
|
|
pkg-config \
|
|
libmcrypt-dev \
|
|
php7.2-dev \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
|
|
RUN curl -O http://pear.php.net/go-pear.phar
|
|
RUN php go-pear.phar
|
|
|
|
RUN pecl install mcrypt-1.0.1
|
|
|
|
RUN bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/cli/conf.d/mcrypt.ini"
|
|
RUN bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/apache2/conf.d/mcrypt.ini"
|
|
|
|
RUN phpenmod mcrypt
|
|
RUN phpenmod gd
|
|
RUN phpenmod bcmath
|
|
|
|
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/apache2/php.ini
|
|
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/cli/php.ini
|
|
|
|
RUN useradd -m --uid 1000 --gid 50 docker
|
|
|
|
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
|
|
RUN mkdir -p /var/lib/snipeit/ssl
|
|
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')
|
|
# RUN sed -i 's/return $app;/$env="production";\nreturn $app;/' bootstrap/start.php
|
|
|
|
#copy all configuration files
|
|
# COPY docker/*.php /var/www/html/app/config/production/
|
|
COPY docker/docker.env /var/www/html/.env
|
|
|
|
RUN chown -R docker /var/www/html
|
|
|
|
RUN \
|
|
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/"
|
|
|
|
############## DEPENDENCIES via COMPOSER ###################
|
|
|
|
#global install of composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Get dependencies
|
|
USER docker
|
|
RUN composer install --no-dev --working-dir=/var/www/html
|
|
USER root
|
|
|
|
############### 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
|
|
|
|
############### DATA VOLUME #################
|
|
|
|
VOLUME ["/var/lib/snipeit"]
|
|
|
|
##### START SERVER
|
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# 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"]
|
|
|
|
EXPOSE 80
|
|
EXPOSE 443
|