Skip to content

Commit

Permalink
Update docker support for upcoming v3
Browse files Browse the repository at this point in the history
  • Loading branch information
uberbrady committed May 14, 2016
1 parent 72d54bd commit f03ecd9
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 500 deletions.
22 changes: 18 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:wily
FROM ubuntu:trusty
MAINTAINER Brady Wetherington <[email protected]>

RUN apt-get update && apt-get install -y \
Expand All @@ -12,7 +12,8 @@ php5-gd \
patch \
curl \
vim \
git
git \
mysql-client

RUN php5enmod mcrypt
RUN php5enmod gd
Expand All @@ -28,6 +29,7 @@ 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

Expand All @@ -43,13 +45,21 @@ RUN a2enmod rewrite
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
# 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/*.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/app/private_uploads" && ln -fs "/var/lib/snipeit/data/private_uploads" "/var/www/html/app/private_uploads" && \
rm -r "/var/www/html/public/uploads/avatars" && ln -fs "/var/lib/snipeit/data/uploads/avatars" "/var/www/html/public/uploads/avatars" && \
rm -r "/var/www/html/public/uploads/models" && ln -fs "/var/lib/snipeit/data/uploads/models" "/var/www/html/public/uploads/models" && \
rm -r "/var/www/html/public/uploads/suppliers" && ln -fs "/var/lib/snipeit/data/uploads/suppliers" "/var/www/html/public/uploads/suppliers" && \
rm -r "/var/www/html/app/storage/dumps" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/app/storage/dumps"

############## DEPENDENCIES via COMPOSER ###################

#global install of composer
Expand All @@ -67,6 +77,10 @@ RUN cd /var/www/html;composer install
#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
Expand Down
10 changes: 7 additions & 3 deletions docker.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Docker Environment File

#Database Variables
MYSQL_ROOT_PASSWORD=supersecuresecretthing
MYSQL_DATABASE=snipeit
MYSQL_USER=snipeit
MYSQL_PASSWORD=tinglewingler
Expand All @@ -15,6 +16,9 @@ [email protected]
MAIL_ENV_PASSWORD=N7AqLufTZMULWHWYwJ0ZCw

#SNIPE-IT Variables
SNIPEIT_TIMEZONE=America/Los_Angeles
SNIPEIT_LOCALE=es-ES
SERVER_URL=https://192.168.99.100:32775
APP_ENV=develop
APP_DEBUG=true
APP_KEY=Y5hJeC7x1i7OxhDrvrQPlB9KvCorvRdO
APP_URL=http:https://127.0.0.1:32782
APP_TIMEZONE=US/Pacific
APP_LOCALE=en
4 changes: 2 additions & 2 deletions docker/001-default-ssl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
#SSLCertificateFile /etc/ssl/private/ssl-cert-snakeoil.crt
SSLCertificateFile /etc/ssl/private/snipeit-ssl.crt
SSLCertificateFile /var/lib/snipeit/ssl/snipeit-ssl.crt
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SSLCertificateKeyFile /etc/ssl/private/snipeit-ssl.key
SSLCertificateKeyFile /var/lib/snipeit/ssl/snipeit-ssl.key

# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
Expand Down
49 changes: 0 additions & 49 deletions docker/app.php

This file was deleted.

77 changes: 0 additions & 77 deletions docker/app_install.exp

This file was deleted.

125 changes: 0 additions & 125 deletions docker/database.php

This file was deleted.

18 changes: 14 additions & 4 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@
cd /var/www/html

# fix key if needed
if grep -q Change_this_key_or_snipe_will_get_ya app/config/production/app.php
if [ -z "$APP_KEY" ]
then
MYSQL_PORT_3306_TCP_ADDR='' MYSQL_PORT_3306_TCP_PORT='' MYSQL_ENV_MYSQL_DATABASE='' \
MYSQL_ENV_MYSQL_USER='' MYSQL_ENV_MYSQL_PASSWORD='' php artisan --env=production -n key:generate
echo "Please re-run this container with an environment variable \$APP_KEY"
echo "An example APP_KEY you could use is: "
php artisan key:generate --show
exit
fi

if [ -f /etc/ssl/private/snipeit-ssl.crt -a -f /etc/ssl/private/snipeit-ssl.key ]
if [ -f /var/lib/snipeit/ssl/snipeit-ssl.crt -a -f /var/lib/snipeit/ssl/snipeit-ssl.key ]
then
a2enmod ssl
else
a2dismod ssl
fi

# create data directories
for dir in 'data/private_uploads' 'data/uploads' 'data/uploads/avatars' 'data/uploads/models' 'data/uploads/suppliers' 'dumps'; do
mkdir -p "/var/lib/snipeit/$dir"
done

chown -R docker:root /var/lib/snipeit/data/*
chown -R docker:root /var/lib/snipeit/dumps

. /etc/apache2/envvars
exec apache2 -DNO_DETACH < /dev/null
Loading

0 comments on commit f03ecd9

Please sign in to comment.