Add dev dockerfiles

This commit is contained in:
Ari Timonen 2019-12-08 02:19:36 +02:00
parent eb67122771
commit 4402677704
2 changed files with 62 additions and 0 deletions

25
Dockerfile.dev Normal file
View file

@ -0,0 +1,25 @@
FROM ruby:2.2.10
ENV RAILS_ENV development
# Add 'web' user which will run the application
RUN adduser web --home /home/web --shell /bin/bash --disabled-password --gecos ""
RUN apt-get update && apt-get -y upgrade \
&& apt-get -y install mysql-client libmysqlclient-dev memcached nodejs firefox-esr \
&& service memcached start
# Separate Gemfile ADD so that `bundle install` can be cached more effectively
ADD Gemfile Gemfile.lock /var/www/
RUN mkdir -p /var/bundle && chown -R web:web /var/bundle && chown -R web:web /var/www
RUN su -c "bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4" -s /bin/bash -l web
WORKDIR /var/www
USER web
RUN bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4
USER root
CMD ["/var/www/script/entry.sh"]

37
docker-compose.dev.yml Normal file
View file

@ -0,0 +1,37 @@
version: "3"
services:
web:
build:
context: ./
dockerfile: Dockerfile.dev
args:
buildno: 1
volumes:
- ".:/var/www/"
ports:
- "4000:4000"
links:
- db
- memcached
# - redis
db:
# Debug
# command: bash
#tty: true
command: mysqld_safe --skip-grant-tables
image: mariadb:latest
volumes:
- "./db_data:/var/lib/mysql"
- "./ext/mysql.conf.d:/etc/mysql/conf.d"
environment:
- MYSQL_DATABASE=ensl
- MYSQL_USER=ensl
- MYSQL_USERNAME=ensl
- MYSQL_PASSWORD=ensl
- MYSQL_ROOT_PASSWORD=ensl
- MYSQL_ROOT_HOST=%
memcached:
image: memcached:latest
#redis:
# image: redis