forked from forem/forem
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds optional support for Docker/Compose (forem#296)
* Adds optional support for Docker/Compose * Upgrades Dockerfile to use a multi-stage build * Gets rest of stack running in Docker * Renames queue to jobs, uses jobs namespace command * Reverts file * Adds webpacker * Fixes yarn check issue * Adds Database URL default connection string * Remove daemons gem * Update huskyhook config * Update seed.rb * Create .dockerignore * Increase RackTimeout's config * Simplify Docker config * Update README * Remove postgres url default * Change docker entry point to 3000 * Remove duped integrity setting
- Loading branch information
1 parent
8c70c95
commit cfda390
Showing
11 changed files
with
85 additions
and
8 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,5 @@ | ||
.dockerignore | ||
.git | ||
logs/ | ||
tmp/ | ||
node_modules/ |
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,17 @@ | ||
FROM starefossen/ruby-node:2-8-stretch | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY Gemfile Gemfile.lock yarn.lock ./ | ||
|
||
RUN yarn install && yarn check --integrity | ||
|
||
ENV RAILS_ENV development | ||
|
||
ENV YARN_INTEGRITY_ENABLED "false" | ||
|
||
RUN bundle install --jobs 20 --retry 5 | ||
|
||
ENTRYPOINT ["bundle", "exec"] | ||
|
||
CMD ["rails", "server", "-b", "0.0.0.0", "-p", "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.PHONY: run | ||
|
||
run: | ||
docker-compose build && docker-compose run --rm web rails db:setup |
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 |
---|---|---|
|
@@ -151,7 +151,7 @@ This section provides a high-level requirement & quick start guide. For detailed | |
- [Yarn](https://yarnpkg.com/): please refer to their [installation guide](https://yarnpkg.com/en/docs/install). | ||
- [PostgreSQL](https://www.postgresql.org/) 9.4 or higher. | ||
|
||
### Installation | ||
### Standard Installation | ||
|
||
0. Make sure all the prerequisites are installed. | ||
1. Fork dev.to repository, ie. https://github.com/thepracticaldev/dev.to/fork | ||
|
@@ -177,6 +177,18 @@ This section provides a high-level requirement & quick start guide. For detailed | |
[View Full Installation Documentation](https://docs.dev.to/installation/) | ||
### Docker Installation (BETA) | ||
Our docker implementation is incomplete and may not work smoothly. Please kindly report any issues and any contribution is welcomed! | ||
1. Install `docker` and `docker-compose` | ||
1. `git clone [email protected]:thepracticaldev/dev.to.git` | ||
1. Set environment variables above as described in the "Basic Installation" | ||
1. run `docker-compose build` | ||
1. run `docker-compose run web rails db:setup` | ||
1. run `docker-compose up` | ||
1. That's it! Navigate to `localhost:3000` | ||
#### Starting the application | ||
We're mostly a Rails app, with a bit of Webpack sprinkled in. **For most cases, simply running `bin/rails server` will do.** If you're working with Webpack though, you'll need to run the following: | ||
|
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,29 @@ | ||
version: "3" | ||
services: | ||
web: &rails_base | ||
build: | ||
dockerfile: Dockerfile | ||
context: . | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- db | ||
environment: | ||
RAILS_ENV: development | ||
DATABASE_URL: postgres://postgres:mysecretpassword@db:5432/postgres | ||
YARN_INTEGRITY_ENABLED: "false" | ||
volumes: | ||
- .:/usr/src/app | ||
command: bundle exec rails server -b 0.0.0.0 -p 3000 | ||
jobs: | ||
ports: [] | ||
<<: *rails_base | ||
command: rails jobs:work | ||
webpacker: | ||
ports: [] | ||
<<: *rails_base | ||
command: ./bin/webpack-dev-server | ||
db: | ||
image: postgres | ||
ports: | ||
- "5432:5432" |
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