diff --git a/Dockerfile b/Dockerfile index b58ac43..0d635b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,7 @@ COPY . ./ # Copy the entrypoint scripts COPY entrypoint.sh ./entrypoint.sh COPY sidekiq-entrypoint.sh ./sidekiq-entrypoint.sh +COPY rails-entrypoint.sh ./rails-entrypoint.sh # Make sure the entrypoint scripts are executable RUN chmod +x entrypoint.sh sidekiq-entrypoint.sh @@ -35,5 +36,7 @@ RUN SECRET_KEY_BASE=dummy_key RAILS_ENV=production bundle exec rake assets:preco # Expose the application port EXPOSE 3000 +ENTRYPOINT ["./entrypoint.sh"] + # Default command to run the Rails server CMD bundle exec rails db:migrate && bundle exec rails server -b 0.0.0.0 -p 3000 diff --git a/VERSION b/VERSION index 924eff6..c6678ff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.10-alpha \ No newline at end of file +1.0.11-alpha \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7d79db2..50e7136 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: web: build: . - entrypoint: ["./entrypoint.sh"] + entrypoint: ["./rails-entrypoint.sh"] volumes: - .:/app - ./storage:/app/storage diff --git a/entrypoint.sh b/entrypoint.sh index 1d6b9ac..e8938a1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,21 +1,10 @@ #!/bin/bash -set -e -echo "Starting entrypoint.sh" -export REDIS_URL=redis://redis:6379/1 -# Ensure SECRET_KEY_BASE is set -if [ -z "$SECRET_KEY_BASE" ]; then - export SECRET_KEY_BASE=$(bin/rails secret) -fi +# Call the first entrypoint script +./rails-entrypoint.sh -echo "Running bundle exec rake assets:precompile" -rm -f /app/tmp/pids/server.pid +# Call the second entrypoint script +./sidekiq-entrypoint.sh -echo "Running bundle exec rake assets:precompile" -bundle exec rake assets:precompile RAILS_ENV=production - -echo "Running bundle exec rails db:migrate RAILS_ENV=production" -bundle exec rails db:migrate RAILS_ENV=production - -echo "Executing final command: $@" +# Finally, execute the command passed to the Docker container exec "$@" diff --git a/rails-entrypoint.sh b/rails-entrypoint.sh new file mode 100755 index 0000000..1d6b9ac --- /dev/null +++ b/rails-entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -e +echo "Starting entrypoint.sh" +export REDIS_URL=redis://redis:6379/1 + +# Ensure SECRET_KEY_BASE is set +if [ -z "$SECRET_KEY_BASE" ]; then + export SECRET_KEY_BASE=$(bin/rails secret) +fi + +echo "Running bundle exec rake assets:precompile" +rm -f /app/tmp/pids/server.pid + +echo "Running bundle exec rake assets:precompile" +bundle exec rake assets:precompile RAILS_ENV=production + +echo "Running bundle exec rails db:migrate RAILS_ENV=production" +bundle exec rails db:migrate RAILS_ENV=production + +echo "Executing final command: $@" +exec "$@"