diff --git a/Dockerfile b/Dockerfile index fb9fe4a8..7b8ea58e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,12 @@ WORKDIR /app # Launch processes in Procfile RUN gem install foreman -COPY Gemfile /app/Gemfile -COPY Gemfile.lock /app/Gemfile.lock +# Copy Gemfile and install gems +COPY Gemfile* /app/ RUN bundle install +# Copy package.json and install packages +COPY package.json yarn.lock /app/ RUN yarn install --check-files COPY . /app diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index a48340f5..774f4bac 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -4,13 +4,6 @@ set -e if [ "$UPDATE" = 1 ]; then - echo "UPDATE (yarn packages, db preparation and webpack compilation)" - - # Launch yarn install - echo "Launching yarn install..." - yarn install - echo "yarn install successfully executed." - # Create database, load schema, run migrations and seed data in an idempotent way. echo "Preparing database..." rake db:prepare @@ -20,6 +13,8 @@ if [ "$UPDATE" = 1 ]; then echo "Compiling JS and CSS with webpack..." ./bin/webpack echo "Webpack compilation completed." + + exit 0 fi # Remove a potentially pre-existing server.pid for Rails. diff --git a/script/docker-build.sh b/script/docker-build.sh deleted file mode 100755 index 95acceb3..00000000 --- a/script/docker-build.sh +++ /dev/null @@ -1 +0,0 @@ -docker-compose build \ No newline at end of file diff --git a/script/docker-run.sh b/script/docker-run.sh index 51f18420..6111d121 100755 --- a/script/docker-run.sh +++ b/script/docker-run.sh @@ -1 +1,3 @@ +echo "Starting Astuto..." + docker-compose up "$@" \ No newline at end of file diff --git a/script/docker-update-and-run.sh b/script/docker-update-and-run.sh new file mode 100755 index 00000000..8e5ef02c --- /dev/null +++ b/script/docker-update-and-run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +/bin/bash script/docker-update.sh +/bin/bash script/docker-run.sh \ No newline at end of file diff --git a/script/docker-update.sh b/script/docker-update.sh index 4633ba36..79590710 100755 --- a/script/docker-update.sh +++ b/script/docker-update.sh @@ -1 +1,10 @@ -docker-compose run --rm -e UPDATE=1 web echo "Update completed." \ No newline at end of file +echo "Starting update..." +echo "-> Docker image will be rebuilt if necessary" +echo "-> Database schema will be updated if necessary" +echo "-> Webpack will compile assets" + +docker-compose build +docker-compose run --rm web yarn install # needed to avoid yarn integrity check fail +docker-compose run --rm -e UPDATE=1 web + +echo "Update completed." \ No newline at end of file