Dockerfile 1.7 KB

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