mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
Improve docker scripts
This commit is contained in:
@@ -14,10 +14,12 @@ WORKDIR /app
|
|||||||
# Launch processes in Procfile
|
# Launch processes in Procfile
|
||||||
RUN gem install foreman
|
RUN gem install foreman
|
||||||
|
|
||||||
COPY Gemfile /app/Gemfile
|
# Copy Gemfile and install gems
|
||||||
COPY Gemfile.lock /app/Gemfile.lock
|
COPY Gemfile* /app/
|
||||||
RUN bundle install
|
RUN bundle install
|
||||||
|
|
||||||
|
# Copy package.json and install packages
|
||||||
|
COPY package.json yarn.lock /app/
|
||||||
RUN yarn install --check-files
|
RUN yarn install --check-files
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|||||||
@@ -4,13 +4,6 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$UPDATE" = 1 ]; then
|
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.
|
# Create database, load schema, run migrations and seed data in an idempotent way.
|
||||||
echo "Preparing database..."
|
echo "Preparing database..."
|
||||||
rake db:prepare
|
rake db:prepare
|
||||||
@@ -20,6 +13,8 @@ if [ "$UPDATE" = 1 ]; then
|
|||||||
echo "Compiling JS and CSS with webpack..."
|
echo "Compiling JS and CSS with webpack..."
|
||||||
./bin/webpack
|
./bin/webpack
|
||||||
echo "Webpack compilation completed."
|
echo "Webpack compilation completed."
|
||||||
|
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove a potentially pre-existing server.pid for Rails.
|
# Remove a potentially pre-existing server.pid for Rails.
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
docker-compose build
|
|
||||||
@@ -1 +1,3 @@
|
|||||||
|
echo "Starting Astuto..."
|
||||||
|
|
||||||
docker-compose up "$@"
|
docker-compose up "$@"
|
||||||
4
script/docker-update-and-run.sh
Executable file
4
script/docker-update-and-run.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
/bin/bash script/docker-update.sh
|
||||||
|
/bin/bash script/docker-run.sh
|
||||||
@@ -1 +1,10 @@
|
|||||||
docker-compose run --rm -e UPDATE=1 web echo "Update completed."
|
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."
|
||||||
Reference in New Issue
Block a user