Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
docker: backport dev's dockerfile components
.dockerignore | 73 ++++++++++++++++++++++++++++++++++++++ config/database.yml.docker | 59 ++++++++++++++++++++++++++++++ config/docker/dev/Dockerfile | 26 +++++++------
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..039d801e845b96b0b07232e4b72e6a8a0ca2649e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,73 @@ +git +.gitignore +README.md + +# +# OS X +# +.DS_Store +.AppleDouble +.LSOverride +# Icon must end with two \r +Icon +# Thumbnails +._* +# Files that might appear on external disk +.Spotlight-V100 +.Trashes +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# +# Vagrant +# +coreos +.env +.vagrant + +# +# Rails +# +.env +.env.sample +*.rbc +capybara-*.html +.rspec +log +*/*.log +*/*/*.log +tmp +db/*.sqlite3 +db/*.sqlite3-journal +public/system +coverage/ +spec/tmp +**.orig +rerun.txt +pickle-email-*.html + +# TODO Comment out these rules if you are OK with secrets being uploaded to the repo +#config/initializers/secret_token.rb +#config/secrets.yml + +## Environment normalisation: +.bundle + +# these should all be checked in to normalise the environment: +# Gemfile.lock, .ruby-version, .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +# if using bower-rails ignore default bower_components path bower.json files +vendor/assets/bower_components +*.bowerrc +bower.json + +# Ignore pow environment settings +.powenv + diff --git a/config/database.yml.docker b/config/database.yml.docker new file mode 100644 index 0000000000000000000000000000000000000000..7af829ce7f2be9e8c784814d7c29e199630e4de0 --- /dev/null +++ b/config/database.yml.docker @@ -0,0 +1,59 @@ +# PostgreSQL. Versions 7.4 and 8.x are supported. +# +# Install the ruby-postgres driver: +# gem install ruby-postgres +# On Mac OS X: +# gem install ruby-postgres -- --include=3D/usr/local/pgsql +# On Windows: +# gem install ruby-postgres +# Choose the win32 build. +# Install PostgreSQL and put its /bin directory on your path. +development: + adapter: postgresql + encoding: unicode + database: noosfero_development + template: template0 + username: <%= (ENV['POSTGRES_USER'] || 'noosfero') %> + password: <%= (ENV['POSTGRES_PASSWORD'] || '') %> + host: <%= (ENV['POSTGRES_HOST'] || '') %> + pool: <%= (ENV['DB_POOL'] || '20').to_i %> + + # Connect on a TCP socket. Omitted by default since the client uses a + # domain socket that doesn't need configuration. Windows does not have + # domain sockets, so uncomment these lines. + #host: localhost + #port: 5432 + + # Schema search path. The server defaults to $user,public + #schema_search_path: myapp,sharedapp,public + + # Minimum log levels, in increasing order: + # debug5, debug4, debug3, debug2, debug1, + # log, notice, warning, error, fatal, and panic + # The server defaults to notice. + #min_messages: warning + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: &TEST + adapter: postgresql + encoding: unicode + database: noosfero_test + template: template0 + username: <%= (ENV['POSTGRES_USER'] || 'noosfero') %> + password: <%= (ENV['POSTGRES_PASSWORD'] || '') %> + host: <%= (ENV['POSTGRES_HOST'] || '') %> + +production: + adapter: postgresql + encoding: unicode + database: <%= (ENV['POSTGRES_DB'] || 'noosfero_production') %> + template: template0 + username: <%= (ENV['POSTGRES_USER'] || 'noosfero') %> + password: <%= (ENV['POSTGRES_PASSWORD'] || '') %> + host: <%= (ENV['POSTGRES_HOST'] || '') %> + pool: <%= (ENV['DB_POOL'] || '20').to_i %> + +cucumber: + <<: *TEST diff --git a/config/docker/dev/Dockerfile b/config/docker/dev/Dockerfile index 7ed46133feefdb63895f81d29f9fb229c26134e4..ff137e1fffddddc80c3e4b3b84d94638abbf9071 100644 --- a/config/docker/dev/Dockerfile +++ b/config/docker/dev/Dockerfile @@ -1,18 +1,20 @@ -# Noosfero development environment -# -# VERSION 0.0.1 +FROM ruby:2.3-stretch -FROM debian:jessie -MAINTAINER Noosfero Development Team <noosfero-dev@listas.softwarelivre.org> - +LABEL Maintainer="Noosfero Development Team <noosfero-dev@listas.softwarelivre.org>" LABEL Description="This dockerfile builds a noosfero development environment." -WORKDIR /src/noosfero -RUN apt-get update && apt-get install -y sudo git -RUN git clone --depth 1 https://gitlab.com/noosfero/noosfero.git . +EXPOSE 3000 -RUN sh script/quick-start --skip-translations +RUN apt-get update && apt-get install -y sudo cron nodejs postgresql-client + +WORKDIR /noosfero +ADD . /noosfero/ + +RUN echo "IRB.conf[:SAVE_HISTORY] = 100" >> .irbrc +RUN echo "IRB.conf[:HISTORY_FILE] = '~/.irb-history'" >> .irbrc -RUN service postgresql start && sleep 2 && ruby script/sample-data +RUN ./script/quick-start -i -EXPOSE 3000 +ENTRYPOINT ["/noosfero/config/docker/dev/entrypoint.sh"] +CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"] +