forked from CircleCI-Public/circleci-demo-ruby-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
0 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 |
---|---|---|
|
@@ -27,3 +27,6 @@ | |
# Ignore dist files | ||
/public/assets | ||
|
||
# Ignore env files | ||
*.env | ||
|
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 ruby:2.4.2-stretch | ||
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client | ||
|
||
RUN mkdir /myapp | ||
WORKDIR /myapp | ||
COPY Gemfile /myapp/Gemfile | ||
COPY Gemfile.lock /myapp/Gemfile.lock | ||
RUN bundle install | ||
COPY . /myapp | ||
|
||
|
||
# Add a script to be executed every time the container starts. | ||
COPY entrypoint.sh /usr/bin/ | ||
RUN chmod +x /usr/bin/entrypoint.sh | ||
ENTRYPOINT ["entrypoint.sh"] | ||
EXPOSE 3000 | ||
|
||
# Start the main process. | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: '3' | ||
services: | ||
db: | ||
image: postgres:9.5 | ||
volumes: | ||
- ./tmp/db:/var/lib/postgresql/data | ||
restart: always | ||
env_file: | ||
- db.env | ||
web: | ||
build: . | ||
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'; env" | ||
volumes: | ||
- .:/myapp | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- db | ||
env_file: | ||
- app.env |
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,8 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Remove a potentially pre-existing server.pid for Rails. | ||
rm -f /myapp/tmp/pids/server.pid | ||
|
||
# Then exec the container's main process (what's set as CMD in the Dockerfile). | ||
exec "$@" |