mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 03:07:52 +01:00
Improve docker automation
This commit is contained in:
@@ -12,7 +12,6 @@ COPY Gemfile.lock /app/Gemfile.lock
|
|||||||
RUN bundle install
|
RUN bundle install
|
||||||
|
|
||||||
RUN yarn install --check-files
|
RUN yarn install --check-files
|
||||||
RUN yarn install
|
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ services:
|
|||||||
- ./tmp/db:/var/lib/postgresql/data
|
- ./tmp/db:/var/lib/postgresql/data
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
|
environment:
|
||||||
|
- UPDATE=0
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -3,15 +3,24 @@
|
|||||||
# Exit immediately if a command exits with a non-zero status.
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Create database, load schema, run migrations and seed data in an idempotent way.
|
if [ "$UPDATE" = 1 ]; then
|
||||||
echo "Preparing database..."
|
echo "UPDATE (yarn packages, db preparation and webpack compilation)"
|
||||||
rake db:prepare
|
|
||||||
echo "Database prepared."
|
|
||||||
|
|
||||||
# Use webpack to build JS and CSS.
|
# Launch yarn install
|
||||||
echo "Compiling JS and CSS with webpack..."
|
echo "Launching yarn install..."
|
||||||
./bin/webpack
|
yarn install
|
||||||
echo "Webpack compilation completed."
|
echo "yarn install successfully executed."
|
||||||
|
|
||||||
|
# Create database, load schema, run migrations and seed data in an idempotent way.
|
||||||
|
echo "Preparing database..."
|
||||||
|
rake db:prepare
|
||||||
|
echo "Database prepared."
|
||||||
|
|
||||||
|
# Use webpack to build JS and CSS.
|
||||||
|
echo "Compiling JS and CSS with webpack..."
|
||||||
|
./bin/webpack
|
||||||
|
echo "Webpack compilation completed."
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove a potentially pre-existing server.pid for Rails.
|
# Remove a potentially pre-existing server.pid for Rails.
|
||||||
rm -f /app/tmp/pids/server.pid
|
rm -f /app/tmp/pids/server.pid
|
||||||
|
|||||||
1
script/docker-build.sh
Executable file
1
script/docker-build.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
docker-compose build
|
||||||
1
script/docker-run.sh
Executable file
1
script/docker-run.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
docker-compose up "$@"
|
||||||
1
script/docker-update.sh
Executable file
1
script/docker-update.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
docker-compose run --rm -e UPDATE=1 web echo "Update completed."
|
||||||
Reference in New Issue
Block a user