Skip to content

Another one solution #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerdev/Aptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vim
60 changes: 60 additions & 0 deletions .dockerdev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ARG RUBY_VERSION
FROM ruby:$RUBY_VERSION

ARG BUNDLER_VERSION
ARG PG_MAJOR
ARG NODE_MAJOR

# Common dependencies
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
build-essential \
gnupg2 \
curl \
less \
git \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log

# Add PostgreSQL to sources list
RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list


# Add NodeJS to sources list
RUN curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR.x | bash -


# Application dependencies
# We use an external Aptfile for that, stay tuned
COPY ./Aptfile /tmp/Aptfile
RUN apt-get update -qq
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
nodejs \
$(cat /tmp/Aptfile | xargs) && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
truncate -s 0 /var/log/*log

# Configure bundler
ENV LANG=C.UTF-8 \
BUNDLE_JOBS=4 \
BUNDLE_RETRY=3

# Uncomment this line if you store Bundler settings in the project's root
# ENV BUNDLE_APP_CONFIG=.bundle

# Uncomment this line if you want to run binstubs without prefixing with `bin/` or `bundle exec`
# ENV PATH /app/bin:$PATH

# Upgrade RubyGems and install required Bundler version
RUN gem update --system && \
gem install bundler:$BUNDLER_VERSION

# Create a directory for the app code
RUN mkdir -p /app

WORKDIR /app
2 changes: 2 additions & 0 deletions .dockerdev/env/database
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=supersecure
1 change: 1 addition & 0 deletions .dockerdev/env/web
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_HOST=database
22 changes: 20 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*
Expand All @@ -13,4 +12,23 @@ capybara-*.html
/spec/tmp/*
**.orig
rerun.txt
pickle-email-*.html
pickle-email-*.html

# Rails stuff
/source/.bundle
/source/vendor/bundle/
/source/doc
/source/log/*
/source/tmp

# various artifacts
**.war
/source/public/cache
/source/public/stylesheets/compiled
/source/public/uploads
/source/public/system
/source/spec/tmp/*
/source/cache

# Mac finder artifacts
.DS_Store
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3.7'

volumes:
db_data:
gem_cache:

services:
web:
build:
context: .dockerdev
dockerfile: Dockerfile
args:
RUBY_VERSION: '2.3.8'
PG_MAJOR: '11'
NODE_MAJOR: '10'
BUNDLER_VERSION: '1.17.3'
command: bundle exec rails server -b 0.0.0.0
ports:
- "3000:3000"
volumes:
- ./source:/app
- gem_cache:/usr/local/bundle
env_file:
- .dockerdev/env/web
- .dockerdev/env/database
depends_on:
- database
# - redis
tty: true
stdin_open: true
tmpfs:
- /tmp

database:
image: postgres:11
env_file:
- .dockerdev/env/database
volumes:
- db_data:/var/lib/postgresql/data

# redis:
# image: redis:5.0
1 change: 1 addition & 0 deletions source/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--format documentation
50 changes: 50 additions & 0 deletions source/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
source 'https://rubygems.org'

ruby '2.3.8'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.11.3'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails', '~> 4.1.0'
gem 'pry-byebug'
end

group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end

group :test do
gem 'capybara'
end
Loading