Dockerfile
# set base ruby imageFROM ruby:3.3.7 # update repositoriesRUN echo 'deb http://archive.debian.org/debian/ stretch main' > /etc/apt/sources.listRUN apt-get update # install needed packagesRUN apt-get install -y build-essential libpq-dev nginx nodejs # install foremanRUN gem install foreman # if this is changed it also needs to be changed in nginx-sites.conf and unicorn.rbENV APP_HOME /lara RUN mkdir $APP_HOMEWORKDIR $APP_HOME ADD Gemfile* $APP_HOME/ # Determine Bundler version and install it, then copy the Gemfile.lock created during build so# it isn't overridden by the following addRUN BUNDLER_VERSION=$(grep -A1 "BUNDLED WITH" Gemfile.lock | tail -n1) && \ gem install bundler -v "$BUNDLER_VERSION" && \ bundle _"$BUNDLER_VERSION"_ install --without development test && \ cp Gemfile.lock Gemfile.lock-docker ADD . $APP_HOME # get files into the right placeRUN mv -f Gemfile.lock-docker Gemfile.lock && \ cp config/database.sample.yml config/database.yml && \ cp docker/prod/app_environment_variables.rb config/ ## Configured nginx (after bundler so we don't have to wait for bundler to change config)RUN echo "\ndaemon off;" >> /etc/nginx/nginx.confRUN chown -R www-data:www-data /var/lib/nginx # Add default nginx configADD docker/prod/nginx-sites.conf /etc/nginx/sites-enabled/default # forward nginx request and error logs to docker log collectorRUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log # set productionENV RAILS_ENV=production # We need to fake an ENV Var for the precompile: https://github.com/rails/rails/issues/32947# Run precompile rake task in order to at least generate the manifest fileRUN RAILS_SECRET_KEY_BASE=dummy bundle exec rake assets:precompile # pass in a version while building with --build-arg LARA_VERSION=x.y.zARG LARA_VERSIONENV LARA_IMAGE_VERSION=$LARA_VERSION EXPOSE 80 CMD ./docker/prod/run.sh