Last active
May 21, 2018 08:09
-
-
Save sbounmy/7067569d96878939a021d3e4fcb34d11 to your computer and use it in GitHub Desktop.
api/Dockerfile
This file contains 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
FROM driftrock/heroku-cli:latest as heroku | |
FROM ruby:2.4-jessie | |
MAINTAINER Stephane BOUNMY <stephane@hackerhouse.paris> | |
# Install apt based dependencies required to run Rails as | |
# well as RubyGems. As the Ruby image itself is based on a | |
# Debian image, we use apt-get to install those. | |
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 | |
RUN echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.6 main" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list | |
RUN apt-get update && apt-get upgrade -y | |
RUN apt-get install build-essential -y \ | |
git \ | |
mongodb-org-tools | |
# Copy executable from heroku image (optional) | |
# Image may need to capp heroku cli | |
COPY --from=heroku /usr/local/bin/heroku /usr/local/bin/heroku | |
RUN heroku update | |
# Configure the main working directory. This is the base | |
# directory used in any further RUN, COPY, and ENTRYPOINT | |
# commands. | |
# RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# Copy the Gemfile as well as the Gemfile.lock and install | |
# the RubyGems. This is a separate step so the dependencies | |
# will be cached unless changes to one of those two files | |
# are made. | |
COPY Gemfile* ./ | |
RUN gem install bundler && bundle install --jobs 20 --retry 5 | |
# Copy the main application. | |
COPY . . | |
# Fixes sublime text relative path so docker-compose run test work whenever we run from ./hackerhouse or ./hackerhouse/api | |
# Example : | |
# In /usr/src/app | |
# docker-compose run --rm test bundle exec rspec api/spec/features/login_feature_spec.rb:14 | |
RUN ln -s . api |
This file contains 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
FROM node:8.2.1-alpine | |
ENV NPM_CONFIG_LOGLEVEL warn | |
WORKDIR /app | |
COPY . . | |
# Build for production. | |
# RUN npm run build --production | |
# Install `serve` to run the application. | |
# RUN npm install -g serve | |
RUN npm install | |
# Set the command to start the node server. | |
# CMD serve -s build | |
# # Tell Docker about the port we'll run on. | |
# EXPOSE 5000 |
This file contains 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
version: '3' | |
services: | |
################ | |
# Database # | |
################ | |
mongo: #database | |
image: mongo:3.6.0 | |
ports: | |
- "27018:27017" | |
volumes: | |
- ./data/db:/data/db | |
################ | |
# Development # | |
################ | |
api: # rails json api | |
build: ./api | |
image: hackerhouse_api:latest | |
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" | |
volumes: | |
- ./api/:/usr/src/app/ | |
depends_on: | |
- mongo | |
env_file: | |
- ./api/.env | |
ports: ['3000:3000'] | |
app: # react app | |
build: ./client | |
image: hackerhouse_app:latest | |
command: npm start | |
volumes: | |
- ./client:/app | |
- /app/node_modules | |
ports: ['3001:3001'] | |
################ | |
# Test # | |
################ | |
test: # execute rails tests | |
image: hackerhouse_api:latest | |
command: bundle exec rspec spec spec/features | |
environment: | |
- SELENIUM_REMOTE_HOST=selenium | |
volumes: | |
- ./api/:/usr/src/app/ | |
depends_on: | |
- selenium | |
- mongo | |
- test_app | |
- test_api | |
test_api: # rails json api | |
image: hackerhouse_api:latest | |
command: bash -c "rm -f tmp/pids/test_server.pid && RAILS_ENV=test bundle exec rails s -p 3002 -b '0.0.0.0' -P tmp/pids/test_server.pid" | |
ports: ['3002:3002'] | |
volumes: | |
- ./api/:/usr/src/app/ | |
depends_on: | |
- mongo | |
test_app: # react app | |
environment: | |
- REACT_APP_API=http://test_api:3002 | |
image: hackerhouse_app:latest | |
command: npm start | |
volumes: | |
- ./client:/app | |
- /app/node_modules | |
ports: ['3001'] | |
selenium: # firefox | |
image: selenium/standalone-firefox-debug:latest | |
ports: ['4444:4444', '5900:5900'] | |
environment: | |
- SCREEN_WIDTH=1440 | |
- SCREEN_HEIGHT=900 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment