Run:
chmod +x pre-push.sh
ln -s ../../pre-push.sh .git/hooks/pre-push
and the script will be executed before each git push. You can skip the hook by adding --no-verify
to your git push
.
Run:
chmod +x pre-push.sh
ln -s ../../pre-push.sh .git/hooks/pre-push
and the script will be executed before each git push. You can skip the hook by adding --no-verify
to your git push
.
#!/bin/bash +x | |
set -e | |
# Remove unnecessary files | |
echo -e "\033[34mRemoving unnecessary files...\033[0m" | |
rm -f log/*.log &> /dev/null || true &> /dev/null | |
rm -rf public/uploads/* &> /dev/null || true &> /dev/null | |
# Build Project | |
echo -e "\033[34mBuilding Project...\033[0m" |
#!/bin/bash +x | |
docker-compose --project-name=${JOB_NAME} stop &> /dev/null || true &> /dev/null | |
docker-compose --project-name=${JOB_NAME} rm --force &> /dev/null || true &> /dev/null | |
docker stop `docker ps -a -q -f status=exited` &> /dev/null || true &> /dev/null | |
docker rm -v `docker ps -a -q -f status=exited` &> /dev/null || true &> /dev/null | |
docker rmi `docker images --filter 'dangling=true' -q --no-trunc` &> /dev/null || true &> /dev/null |
FROM ruby:2.2.2 | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
# Install RMagick | |
# RUN apt-get install -y libmagickwand-dev imagemagick | |
# Install Nokogiri | |
# RUN apt-get install -y zlib1g-dev | |
RUN mkdir /myapp |
db: | |
image: postgres | |
ports: | |
- "5432" | |
redis: | |
image: redis | |
ports: | |
- "6379" | |
development: &default | |
adapter: postgresql | |
encoding: unicode | |
database: your-project_development | |
pool: 5 | |
username: <%= ENV.fetch('DB_USERNAME', 'your-project') %> | |
password: <%= ENV.fetch('DB_PASSWORD', 'your-project') %> | |
host: <%= ENV.fetch('DB_1_PORT_5432_TCP_ADDR', 'localhost') %> | |
port: <%= ENV.fetch('DB_1_PORT_5432_TCP_PORT', '5432') %> | |
cat >config/mongoid.yml <<EOF | |
test: | |
sessions: | |
default: | |
database: ${JOB_NAME}_test | |
hosts: | |
- <%= "#{ENV['DB_1_PORT_27017_TCP_ADDR']}:#{ENV['DB_1_PORT_27017_TCP_PORT']}" %> | |
EOF |
group :development do | |
gem 'capistrano', '3.2.1' | |
gem 'capistrano-maintenance', github: 'capistrano/maintenance', require: false | |
gem 'capistrano-rails' | |
gem 'capistrano-rbenv', '~> 2.0' | |
gem 'capistrano-rbenv-install', '~> 1.2.0' | |
gem 'capistrano-nginx-unicorn' | |
gem 'capistrano-sidekiq' | |
gem 'capistrano-rails-console' | |
gem 'capistrano-postgresql', '~> 4.2.0' |
# Config valid only for Capistrano 3.2.1 | |
lock '3.2.1' | |
set :application, 'your-project' | |
set :repo_url, '[email protected]:organization/your-repository.git' | |
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call | |
set :scm, :git | |
set :deploy_to, "/home/ubuntu/apps/#{fetch(:application)}" |
require 'capistrano/setup' | |
require 'capistrano/deploy' | |
require 'capistrano/rbenv' | |
require 'capistrano/rbenv_install' | |
require 'capistrano/bundler' | |
require 'capistrano/rails/assets' | |
require 'capistrano/rails/migrations' | |
require 'capistrano/nginx_unicorn' | |
require 'capistrano/sidekiq' | |
require 'whenever/capistrano' |