-
-
Save diegolinhares/7254802f4d5aa7935f16a613fddf7a87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POSTGRES_USER=postgres | |
POSTGRES_PASSWORD=postgres |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: <%= ENV.fetch('RAILS_MAX_THREADS') { 5 } %> | |
host: db | |
username: <%= ENV['POSTGRES_USER'] %> | |
password: <%= ENV['POSTGRES_PASSWORD'] %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
api: | |
restart: always | |
networks: | |
- backend | |
build: . | |
env_file: .env | |
depends_on: | |
db: | |
condition: service_healthy | |
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0' -e development" | |
volumes: | |
- .:/myapp | |
- gem_cache:/usr/local/bundle/gems | |
ports: | |
- 3000:3000 | |
deploy: | |
replicas: 1 | |
db: | |
restart: always | |
networks: | |
- backend | |
image: postgres:12.4-alpine | |
env_file: .env | |
healthcheck: | |
test: pg_isready -U postgres -h 127.0.0.1 | |
interval: 5s | |
volumes: | |
- pg_data:/var/lib/postgresql/data | |
deploy: | |
replicas: 1 | |
quanto: | |
restart: always | |
networks: | |
- backend | |
image: quantocommons/remote-signer | |
deploy: | |
replicas: 1 | |
volumes: | |
pg_data: | |
gem_cache: | |
networks: | |
backend: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.7.1-alpine as builder | |
RUN apk add --update --no-cache \ | |
build-base \ | |
postgresql-dev \ | |
git \ | |
nodejs \ | |
yarn \ | |
tzdata | |
WORKDIR /myapp | |
COPY Gemfile Gemfile.lock /myapp/ | |
RUN bundle install -j4 --retry 3 && \ | |
# Remove unneeded files (cached *.gem, *.o, *.c) | |
rm -rf /usr/local/bundle/bundler/gems/*/.git \ | |
rm -rf /usr/local/bundle/cache/*.gem && \ | |
find /usr/local/bundle/gems/ -name "*.c" -delete && \ | |
find /usr/local/bundle/gems/ -name "*.o" -delete | |
COPY . /myapp | |
FROM ruby:2.7.1-alpine | |
RUN apk add --update --no-cache \ | |
postgresql-client \ | |
bash \ | |
tzdata | |
COPY entrypoint.sh /usr/bin/ | |
RUN chmod +x /usr/bin/entrypoint.sh | |
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/ | |
COPY --from=builder /myapp /myapp | |
WORKDIR /myapp | |
ENTRYPOINT ["entrypoint.sh"] | |
EXPOSE 3000 | |
CMD ["rails", "server", "-b", "0.0.0.0"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment