Last active
March 19, 2021 03:18
-
-
Save mirzalazuardi/a52c2bd3093451bb2dc545a04740e2b6 to your computer and use it in GitHub Desktop.
docker notes
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
# Dockerfile | |
FROM ruby:2.6.3 | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-client-11 graphviz &&\ | |
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | |
apt-get update && apt-get install -y nodejs yarn | |
RUN mkdir /app | |
WORKDIR /app | |
ADD Gemfile /app/Gemfile | |
ADD Gemfile.lock /app/Gemfile.lock | |
RUN echo 'gem: --no-rdoc --no-ri' >> "$HOME/.gemrc" | |
RUN gem install bundler | |
RUN bundle install | |
ADD . /app | |
# docker-compose.yml | |
version: '2' | |
services: | |
db: | |
image: postgres:11.10 | |
container_name: project_name_db | |
restart: always | |
volumes: | |
- project_name_data:/var/lib/postgresql/data | |
environment: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: password | |
POSTGRES_DBNAME: project_name_db_development | |
ports: | |
- "5433:5432" | |
app: | |
build: . | |
container_name: project_name_web | |
stdin_open: true | |
tty: true | |
command: bundle exec rails s -p 3000 -b '0.0.0.0' | |
volumes: | |
- ".:/app" | |
ports: | |
- "3001:3000" | |
depends_on: | |
- db | |
links: | |
- db | |
environment: | |
DB_USER: root | |
DB_PASSWORD: password | |
DB_NAME: project_name_db_development | |
DB_HOST: db | |
RAILS_ENV: development | |
volumes: | |
project_name_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment