-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34fcdca
commit bd5b7f2
Showing
3 changed files
with
40 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,42 @@ | ||
FROM ruby:3.3.1-alpine | ||
|
||
MAINTAINER Klaus Meyer <spam@klaus-meyer.net> | ||
LABEL maintainer="Klaus Meyer <spam@klaus-meyer.net>" | ||
|
||
ARG SOURCE_COMMIT | ||
ENV SOURCE_COMMIT $SOURCE_COMMIT | ||
|
||
ENV PORT 8080 | ||
ENV SSL_PORT 8443 | ||
ENV RAILS_ENV production | ||
ENV SECRET_KEY_BASE changeme | ||
ENV RAILS_SERVE_STATIC_FILES true | ||
ENV RAILS_LOG_TO_STDOUT true | ||
|
||
EXPOSE $PORT | ||
EXPOSE $SSL_PORT | ||
|
||
WORKDIR /app | ||
|
||
ADD . . | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
||
RUN apk update \ | ||
&& apk add build-base zlib-dev tzdata git openssl-dev shared-mime-info postgresql-dev libc6-compat vips-dev \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& gem install bundler -v $(tail -n1 Gemfile.lock | xargs) \ | ||
&& bundle config set build.sassc '--disable-march-tune-native' \ | ||
&& bundle config set without 'development test' \ | ||
&& bundle install \ | ||
&& bundle exec rails assets:precompile \ | ||
&& addgroup -S app && adduser -S app -G app -h /app \ | ||
&& chown -R app.app /app \ | ||
&& chown -R app.app /usr/local/bundle | ||
|
||
USER app | ||
|
||
CMD puma -C config/puma.rb | ||
&& mkdir -p /var/www/rails | ||
|
||
COPY Gemfile Gemfile.lock /var/www/rails/ | ||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
|
||
WORKDIR /var/www/rails/ | ||
|
||
RUN gem install bundler -v $(grep -A1 "BUNDLED WITH" Gemfile.lock | tail -n1 | tr -d "[:space:]") \ | ||
&& bundle config set build.sassc "--disable-march-tune-native" \ | ||
&& bundle config set without "development test" \ | ||
&& bundle install | ||
|
||
ADD . /var/www/rails/ | ||
|
||
RUN SECRET_KEY_BASE=dummyvalue bundle exec rails assets:precompile | ||
|
||
RUN addgroup -S rails && adduser -S rails -G rails -h /var/www/rails/ \ | ||
&& chown -R rails.rails /var/www/rails/ \ | ||
&& chown -R rails.rails /usr/local/bundle | ||
|
||
USER rails | ||
|
||
CMD ["web"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
case "$1" in | ||
web) | ||
bundle exec rails db:prepare | ||
|
||
exec bundle exec puma -C config/puma.rb | ||
;; | ||
|
||
*) | ||
exec $@ | ||
;; | ||
esac |