Dockerfile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. FROM rubylang/ruby:3.2-jammy
  2. COPY docker/scripts/prepare /scripts/
  3. RUN /scripts/prepare
  4. WORKDIR /app
  5. ENV HOME=/app
  6. ARG UID=1001
  7. RUN useradd -u "$UID" -g 0 -d /app -s /sbin/nologin -c "default user" default
  8. RUN chown -R "$UID:0" /app
  9. USER $UID
  10. ENV LC_ALL=en_US.UTF-8
  11. ENV RAILS_ENV=production
  12. COPY --chown="$UID:0" ["Gemfile", "Gemfile.lock", "/app/"]
  13. COPY --chown="$UID:0" lib/gemfile_helper.rb /app/lib/
  14. RUN mkdir /app/vendor
  15. COPY --chown="$UID:0" vendor/gems/ /app/vendor/gems/
  16. ARG ADDITIONAL_GEMS=
  17. ENV ADDITIONAL_GEMS=$ADDITIONAL_GEMS
  18. # Get rid of annoying "fatal: Not a git repository (or any of the parent directories): .git" messages
  19. RUN git init && \
  20. bundle config set --local path vendor/bundle && \
  21. bundle config set --local without 'test development'
  22. RUN APP_SECRET_TOKEN=secret DATABASE_ADAPTER=mysql2 ON_HEROKU=true bundle install -j 4
  23. COPY --chown="$UID:0" ./ /app/
  24. ARG OUTDATED_DOCKER_REGISTRY=false
  25. ENV OUTDATED_DOCKER_REGISTRY=${OUTDATED_DOCKER_REGISTRY}
  26. RUN APP_SECRET_TOKEN=secret DATABASE_ADAPTER=mysql2 ON_HEROKU=true bundle exec rake assets:clean assets:precompile
  27. EXPOSE 3000
  28. COPY ["docker/scripts/setup_env", "docker/single-process/scripts/init", "/scripts/"]
  29. CMD ["/scripts/init"]