Created
September 21, 2016 16:55
-
-
Save felixbuenemann/ab7b6256e5bd1818cf8679b88e1c11b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.4 | |
RUN apk --no-cache add ruby ruby-irb ruby-json ruby-bigdecimal ruby-rake \ | |
ruby-io-console ruby-bundler libstdc++ tzdata postgresql-client nodejs \ | |
libxml2 libxslt libgcrypt sqlite-libs pcre curl postgresql bash procps \ | |
&& cp /usr/bin/pg_dump /usr/bin/pg_restore /tmp/ \ | |
&& apk del --purge postgresql \ | |
&& mv /tmp/pg_dump /tmp/pg_restore /usr/bin/ \ | |
&& echo "gem: --no-document" > /etc/gemrc | |
ENV PASSENGER_VERSION=5.0.30 | |
RUN apk --no-cache add --virtual passenger-dependencies gcc g++ make \ | |
linux-headers curl-dev pcre-dev ruby-dev \ | |
&& gem install -v $PASSENGER_VERSION passenger \ | |
&& echo "#undef LIBC_HAS_BACKTRACE_FUNC" > /usr/include/execinfo.h \ | |
&& passenger-config install-standalone-runtime --auto \ | |
&& passenger-config build-native-support \ | |
&& apk del --purge passenger-dependencies | |
# Copy just the files for bundle install | |
ADD Gemfile /app/ | |
ADD Gemfile.lock /app/ | |
ADD vendor/cache /app/vendor/cache | |
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \ | |
BUNDLE_IGNORE_MESSAGES=1 \ | |
BUNDLE_GITHUB__HTTPS=1 \ | |
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 \ | |
BUNDLE_FROZEN=1 \ | |
BUNDLE_PATH=/app/vendor/bundle \ | |
BUNDLE_BIN=/app/bin \ | |
BUNDLE_GEMFILE=/app/Gemfile \ | |
BUNDLE_WITHOUT=development:benchmark:test | |
RUN apk --no-cache add --virtual build-dependencies build-base git ruby-dev \ | |
curl-dev postgresql-dev libxml2-dev libxslt-dev libgcrypt-dev sqlite-dev \ | |
&& bundle install \ | |
&& apk del --purge build-dependencies | |
ENV RAILS_ENV=production PATH=/app/bin:$PATH | |
# Copy just the files needed for assets:precompile | |
ADD Rakefile /app/ | |
ADD config /app/config | |
ADD public /app/public | |
ADD app/assets /app/app/assets | |
# Fix loading of solidus base controller. | |
ADD app/controllers/application_controller.rb /app/app/controllers/ | |
RUN cd /app && rake assets:precompile DATABASE_URL=sqlite3:///tmp/dummy.db SECRET_KEY_BASE=dummy | |
ADD . /app | |
RUN chown -R nobody:nogroup /app | |
USER nobody | |
WORKDIR /app | |
EXPOSE 5000 | |
CMD ["passenger", "start", "-p", "5000", "-e", "production", "--app-type", "rack", "--auto"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment