Use a temporary mysql-server for assets precompilation during Docker build

This commit is contained in:
Patrick Gansterer 2017-08-03 02:25:40 +02:00
parent af1243ebea
commit 5bc9becf9a
1 changed files with 16 additions and 0 deletions

View File

@ -19,6 +19,22 @@ RUN buildDeps='libmagic-dev' && \
apt-get purge -y --auto-remove $buildDeps && \
whenever --update-crontab
# Add a temporary mysql-server for assets precompilation
RUN export DATABASE_URL=mysql2://localhost/temp && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y mysql-server && \
/etc/init.d/mysql start && \
cp config/app_config.yml.SAMPLE config/app_config.yml && \
bundle exec rake db:setup && \
bundle exec rake assets:precompile && \
rm config/app_config.yml && \
rm -rf tmp/* && \
/etc/init.d/mysql stop && \
rm -rf /run/mysqld /tmp/* /var/lib/mysql /var/log/mysql* && \
apt-get purge -y --auto-remove mysql-server && \
rm -rf /var/lib/apt/lists/*
EXPOSE 3000
ENTRYPOINT ["./docker-entrypoint.sh"]