add Docker development setup

This commit is contained in:
Andreas Nedbal 2020-04-19 01:17:37 +02:00
parent 57c3e6895c
commit a53015f36e
2 changed files with 59 additions and 0 deletions

30
.docker/ruby/Dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM ruby:2.6
RUN apt-get update -qq && apt-get install -y build-essential
# for postgres
RUN apt-get install -y libpq-dev
# for nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev
# for images
RUN apt-get install -y libmagickwand-dev imagemagick
# for a JS runtime
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
ENV APP_HOME /app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD Gemfile* $APP_HOME/
RUN bundle install
EXPOSE 3000

29
docker-compose.yml Normal file
View File

@ -0,0 +1,29 @@
version: "3.7"
services:
web:
build:
context: .
dockerfile: .docker/ruby/Dockerfile
command:
ruby bin/rails server --port 3000 --binding 0.0.0.0
links:
- postgres
- redis
volumes:
- ./:/app
ports:
- 3000:3000
redis:
image: redis:3.2.11-alpine
ports:
- 6379:6379
postgres:
image: postgres:10.12
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: justask
POSTGRES_DB: justask_development