From a53015f36e6873c69cf3d19657be9715cfd5a0d1 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 19 Apr 2020 01:17:37 +0200 Subject: [PATCH] add Docker development setup --- .docker/ruby/Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .docker/ruby/Dockerfile create mode 100644 docker-compose.yml diff --git a/.docker/ruby/Dockerfile b/.docker/ruby/Dockerfile new file mode 100644 index 00000000..226b4994 --- /dev/null +++ b/.docker/ruby/Dockerfile @@ -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 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..90553f7d --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file