-5
Docker hoá Rails project
Mọi người giúp mình xem Dockerfile và docker-compose.yml của mình sai ở đâu với. Mình đã cài cả bundler lẫn rake rồi nhưng vẫn không chạy được.
Dockerfile:
FROM ruby:2.5.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
apt-get install nodejs
RUN 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 yarn
RUN gem update --system
RUN gem install rake
RUN gem install bundler
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
COPY Gemfile* /usr/src/app/
RUN bundler install
RUN bundle update
RUN bundle install --path vendor/cache
COPY . /usr/src/app/
docker-compose.yml
version: '3'
services:
db:
image: mysql:8.0.13
ports:
- "3306:3306"
volumes:
- db-data:/var/lib/mysql
env_file:
- .env.development
web:
build: .
command: /bin/sh -c "bundle exec rails server --host '0.0.0.0'"
ports:
- "8888:8888"
volumes:
- .:/usr/src/app
environment:
RAILS_ENV: development
env_file:
- .env.development
depends_on:
- db
volumes:
db-data:
Link git: https://github.com/BlazingRockStorm/let-us-go/tree/docker
bạn có thể tham khảo docker config này
Dockerfile
docker-compose.yml