-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker support for development environment
- Loading branch information
1 parent
7ce643f
commit 51f2cc6
Showing
8 changed files
with
214 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
SECRET_KEY_BASE=djiv7839b9j69ew89gf9n5495rh9bvksmk23i8cv9oi54kju1gfi | ||
SITE_HOST=localhost:8282 | ||
MAILER_DELIVERY_METHOD=smtp | ||
RAILS_SERVE_STATIC_FILES=true | ||
SMTP_PORT=1025 | ||
LOG_RECAPTCHA_RESPONSES=true | ||
RECAPTCHA_SITE_KEY= | ||
RECAPTCHA_SECRET_KEY= | ||
SERVER_TIME_ZONE=UTC | ||
RAILS_LOG_LEVEL=info | ||
RAILS_LOG_TO_STDOUT=true | ||
CAPTCHA_GATEWAY_PERMISSION_TIME=30000 | ||
DATABASE_DEV_USERNAME=lumen | ||
DATABASE_DEV_PASSWORD=so-secret | ||
DATABASE_DEV_DB_NAME=lumen_dev | ||
DATABASE_DEV_HOST=postgres | ||
DATABASE_DEV_PORT=5432 | ||
ELASTICSEARCH_URL=elasticsearch | ||
TEST_CLUSTER_COMMAND=/elasticsearch_test/elasticsearch-7.17.0/bin/elasticsearch |
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,45 @@ | ||
FROM ruby:3.0.2 | ||
|
||
WORKDIR /root | ||
|
||
# Google-chrome needs an additional repository | ||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list | ||
RUN wget https://chromedriver.storage.googleapis.com/98.0.4758.102/chromedriver_linux64.zip \ | ||
&& unzip chromedriver_linux64.zip \ | ||
&& mv chromedriver /usr/local/share/ \ | ||
&& chmod +x /usr/local/share/chromedriver \ | ||
&& ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver \ | ||
&& ln -s /usr/local/share/chromedriver /usr/bin/chromedriver | ||
|
||
RUN apt-get update && apt-get -y install tzdata git build-essential patch ruby-dev zlib1g-dev liblzma-dev default-jre sudo google-chrome-stable vim nano | ||
|
||
# Container user and group | ||
ARG USERNAME=lumen | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Create a user | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
USER $USERNAME | ||
|
||
# Install and cache gems | ||
WORKDIR / | ||
COPY Gemfile* /tmp/ | ||
WORKDIR /tmp | ||
RUN bundle install | ||
|
||
# Download a standalone version of Elasticsearch, will be used by rspec | ||
WORKDIR /elasticsearch_test | ||
RUN sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.0-linux-x86_64.tar.gz && sudo tar -xvf elasticsearch-7.17.0-linux-x86_64.tar.gz | ||
RUN sudo chown -R $USERNAME:$USERNAME /elasticsearch_test | ||
|
||
# Code mounted as a volume | ||
WORKDIR /app | ||
|
||
# Just to keep the containder running | ||
CMD (while true; do sleep 1; done;) |
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,32 @@ | ||
default: &default | ||
adapter: postgresql | ||
encoding: utf8 | ||
min_messages: warning | ||
pool: 5 | ||
timeout: 5000 | ||
|
||
test: | ||
<<: *default | ||
username: <%= ENV['DATABASE_DEV_USERNAME'] %> | ||
password: <%= ENV['DATABASE_DEV_PASSWORD'] %> | ||
host: <%= ENV['DATABASE_DEV_HOST'] %> | ||
port: <%= ENV['DATABASE_DEV_PORT'].to_i %> | ||
database: lumen_test | ||
|
||
development: | ||
<<: *default | ||
username: <%= ENV['DATABASE_DEV_USERNAME'] %> | ||
password: <%= ENV['DATABASE_DEV_PASSWORD'] %> | ||
database: <%= ENV['DATABASE_DEV_DB_NAME'] %> | ||
host: <%= ENV['DATABASE_DEV_HOST'] %> | ||
port: <%= ENV['DATABASE_DEV_PORT'].to_i %> | ||
timeout: <%= (ENV['DATABASE_DEV_TIMEOUT'] || 5000).to_i %> | ||
|
||
production: | ||
<<: *default | ||
username: <%= ENV['DATABASE_PROD_USERNAME'] %> | ||
password: <%= ENV['DATABASE_PROD_PASSWORD'] %> | ||
database: <%= ENV['DATABASE_PROD_DB_NAME'] %> | ||
host: <%= ENV['DATABASE_PROD_HOST'] %> | ||
port: <%= ENV['DATABASE_PROD_PORT'].to_i %> | ||
timeout: <%= (ENV['DATABASE_PROD_TIMEOUT'] || 5000).to_i %> |
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 |
---|---|---|
|
@@ -13,4 +13,3 @@ test: | |
pool: 5 | ||
username: postgres | ||
password: postgres | ||
|
This file was deleted.
Oops, something went wrong.
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,50 @@ | ||
version: '2' | ||
|
||
services: | ||
postgres: | ||
image: 'postgres:13.6-alpine' | ||
volumes: | ||
- 'postgres:/var/lib/postgresql/data' | ||
env_file: | ||
- '.env' | ||
environment: | ||
POSTGRES_USER: ${DATABASE_DEV_USERNAME} | ||
POSTGRES_PASSWORD: ${DATABASE_DEV_PASSWORD} | ||
|
||
website: | ||
depends_on: | ||
- 'postgres' | ||
build: . | ||
ports: | ||
- '8282:3000' | ||
- '1080:1080' | ||
volumes: | ||
- '.:/app' | ||
env_file: | ||
- '.env' | ||
|
||
elasticsearch: | ||
image: elasticsearch:7.17.0 | ||
environment: | ||
- http.host=0.0.0.0 | ||
- transport.host=0.0.0.0 | ||
- "ES_JAVA_OPTS=-Xms2g -Xmx2g" | ||
- discovery.type=single-node | ||
volumes: | ||
- esdata:/usr/share/elasticsearch/data | ||
ports: | ||
- 9200:9200 | ||
- 9300:9300 | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
nofile: | ||
soft: 65536 | ||
hard: 65536 | ||
mem_limit: 4g | ||
|
||
volumes: | ||
postgres: | ||
esdata: | ||
esdata_test: |
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