-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from openSUSE/docker
Docker + docker-compose
- Loading branch information
Showing
17 changed files
with
195 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ coverage/* | |
public/upload* | ||
upload* | ||
.byebug_history | ||
docker-compose.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM opensuse/leap:15.1 | ||
|
||
# This includes several packages (like WebKit, xvfb or liberation-fonts) | ||
# That are only needed to run the automated tests and wouldn't be relevant | ||
# in a production environment. | ||
RUN zypper --gpg-auto-import-keys --non-interactive in --no-recommends \ | ||
ruby ruby-devel ruby2.5-rubygem-bundler libxml2-devel libxslt-devel \ | ||
postgresql-devel sqlite3-devel libmariadb-devel \ | ||
libQt5WebKit5 libQt5WebKit5-devel libQt5WebKitWidgets5 libQt5WebKitWidgets-devel \ | ||
xvfb-run which liberation-fonts gcc gcc-c++ make tar gzip patch timezone && \ | ||
zypper clean -a | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY . /app | ||
ENV QMAKE=/usr/bin/qmake-qt5 | ||
RUN bundle install | ||
|
||
CMD ["rails", "server", "-b", "0.0.0.0"] |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Using Docker to Develop TSP | ||
|
||
This repository includes a `Dockerfile` and a set of `docker-compose` configuration examples in | ||
order to simplify the process of setting up a development environment. | ||
|
||
Given that you have `docker` and `docker-compose` installed, the process should be pretty | ||
straighforward. | ||
|
||
1. Select a `docker-compose` configuration file from the `docker/` directory and copy it as | ||
`docker-compose.yml`. For instance, to run the application using a PostgreSQL database: | ||
|
||
cp docker/docker-compose.development.postgresql docker-compose.yml | ||
|
||
2. Uncomment the gem for your favorite database driver from the `Gemfile`. | ||
3. Copy the database configuration from `docker/` for your database. For instance, | ||
to use PostgreSQL: | ||
|
||
cp docker/database.postgresql.yml config/database.yml | ||
|
||
3. Build the image: | ||
|
||
docker-compose build | ||
|
||
4. Now you should be able to set up the database: | ||
|
||
docker-compose run --rm web rake db:setup | ||
|
||
5. (Optional) Run the testsuite to find out whether the application works. | ||
|
||
docker-compose run --rm web xvfb-run -a rake spec | ||
|
||
6. And, now, you can start the application: | ||
|
||
docker-compose up | ||
|
||
For now on, you will need to rebuild the image whenever you change the `Gemfile` or `Gemfile.lock` | ||
files. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Ensure the MySQL connector gem is defined in your Gemfile | ||
# gem 'mysql2' | ||
|
||
# Warning: this proposes the usage of the root user with no password. | ||
# That's done for simplicity because this docker manifest is only meant for | ||
# development purposes and, for that, a user with privileges to create and | ||
# destroy databases is very convenient. | ||
# NEVER use such setup in a production system. | ||
|
||
development: | ||
adapter: mysql2 | ||
database: tsp_development | ||
host: db | ||
username: root | ||
password: | ||
|
||
# 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: | ||
adapter: mysql2 | ||
database: tsp_test | ||
host: db | ||
username: root | ||
password: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Ensure the PostgreSQL connector gem is defined in your Gemfile | ||
# gem 'pg' | ||
|
||
# Warning: this proposes the usage of the postgres superuser with no password. | ||
# That's done for simplicity because this docker manifest is only meant for | ||
# development purposes and, for that, a user with privileges to create and | ||
# destroy databases is very convenient. | ||
# NEVER use such setup in a production system. | ||
|
||
development: | ||
adapter: postgresql | ||
encoding: unicode | ||
database: tsp_development | ||
pool: 5 | ||
host: db | ||
username: postgres | ||
password: | ||
|
||
# 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: | ||
adapter: postgresql | ||
encoding: unicode | ||
database: tsp_test | ||
pool: 5 | ||
host: db | ||
username: postgres | ||
password: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SQLite version 3.x | ||
# gem install sqlite3 | ||
# | ||
# Ensure the SQLite 3 gem is defined in your Gemfile | ||
# gem 'sqlite3' | ||
development: | ||
adapter: sqlite3 | ||
database: db/development.sqlite3 | ||
pool: 5 | ||
timeout: 5000 | ||
|
||
# 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: | ||
adapter: sqlite3 | ||
database: db/test.sqlite3 | ||
pool: 5 | ||
timeout: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '3' | ||
services: | ||
web: | ||
image: tsp:latest | ||
build: . | ||
volumes: | ||
- .:/app | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- db | ||
db: | ||
image: mariadb:10.2 | ||
restart: always | ||
environment: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | ||
# MYSQL_ROOT_PASSWORD: "tsp:secret" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: '3' | ||
services: | ||
web: | ||
image: tsp:latest | ||
build: . | ||
volumes: | ||
- .:/app | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- db | ||
db: | ||
image: postgres:9.6 | ||
restart: always |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '3' | ||
services: | ||
web: | ||
image: tsp:latest | ||
build: . | ||
volumes: | ||
- .:/app | ||
ports: | ||
- "3000:3000" |
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
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
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