2016-02-06 15:52:23 +01:00
|
|
|
FROM ruby:2.3
|
2015-04-26 15:20:05 +02:00
|
|
|
|
|
|
|
RUN apt-get update && \
|
2017-08-02 21:02:39 +02:00
|
|
|
apt-get install --no-install-recommends -y cron && \
|
2015-04-26 15:20:05 +02:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
apt-get clean
|
|
|
|
|
2017-02-11 12:44:49 +01:00
|
|
|
ENV RAILS_ENV=production
|
2015-04-26 15:20:05 +02:00
|
|
|
|
2017-02-11 12:44:49 +01:00
|
|
|
WORKDIR /usr/src/app
|
2016-02-06 15:52:23 +01:00
|
|
|
COPY . ./
|
2017-08-02 21:02:39 +02:00
|
|
|
RUN echo $SOURCE_COMMIT > REVISION
|
|
|
|
|
|
|
|
RUN buildDeps='libmagic-dev' && \
|
|
|
|
apt-get update && \
|
|
|
|
apt-get install --no-install-recommends -y $buildDeps && \
|
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
bundle install --deployment --without development test && \
|
|
|
|
apt-get purge -y --auto-remove $buildDeps && \
|
2017-08-08 23:24:30 +02:00
|
|
|
echo "Foodsoft::Application.config.secret_token = ENV['SECRET_KEY_BASE']" > config/initializers/secret_token.rb && \
|
2017-08-08 23:17:04 +02:00
|
|
|
mkdir -p log && \
|
|
|
|
ln -sfn /dev/stdout log/production.log && \
|
2017-08-08 23:19:39 +02:00
|
|
|
bundle exec whenever --update-crontab
|
2015-04-26 15:20:05 +02:00
|
|
|
|
2017-08-03 02:25:40 +02:00
|
|
|
# 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/*
|
|
|
|
|
2015-04-26 15:20:05 +02:00
|
|
|
EXPOSE 3000
|
|
|
|
|
2017-02-11 12:44:49 +01:00
|
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|
2015-05-15 20:23:53 +02:00
|
|
|
CMD ["rails", "server", "--binding", "0.0.0.0"]
|