-
Notifications
You must be signed in to change notification settings - Fork 0
Configure local Docker development environment for SQLite #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| ruby-4.0.1 | ||
| 4.0.1 |
This file contains hidden or 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 hidden or 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,35 @@ | ||
| # Development Dockerfile for Rails app using sqlite on Alpine | ||
| FROM docker.io/library/ruby:4.0.1-alpine | ||
|
|
||
| ENV RAILS_ENV=development | ||
|
|
||
| # Install build and runtime dependencies (no Node) | ||
| RUN apk add --no-cache \ | ||
| build-base \ | ||
| curl \ | ||
| bash \ | ||
| git \ | ||
| imagemagick \ | ||
| sqlite \ | ||
| sqlite-dev \ | ||
| yaml-dev \ | ||
| tzdata | ||
|
|
||
|
|
||
| # Install latest bundler | ||
| RUN gem install bundler | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy only Gemfile (lock file will be generated at runtime) | ||
| COPY Gemfile Gemfile.lock ./ | ||
| RUN bundle install | ||
|
|
||
| # Copy application code (will be mounted via volume in dev) | ||
| COPY . . | ||
|
|
||
| # Expose default rails port | ||
| EXPOSE 3000 | ||
|
|
||
| # Default to an interactive shell; compose overrides command to run the server. | ||
| CMD ["/bin/bash"] |
This file contains hidden or 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 hidden or 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 hidden or 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,27 @@ | ||
| # Local Development with Docker | ||
|
|
||
| ## Goals | ||
|
|
||
| 1. To have `Dockerfile.dev` and `docker-compose.dev.yml` files that enable Ruby on Rails development completely in Docker. | ||
| 1. The developer should be able to run commands such as `bin/rails s` and `bin/rails c`, `bin/rspec `; ideally, we should have some containers that run in `RAILS_ENV=development` and `RAILS_ENV=test`. | ||
| 1. Some of the database config and other related files were copied from another project, but we need to change this project to use sqlite | ||
| 1. We shouldn't need any config to AWS, for example, but that might change in the future; for now, I don't think we need any references to AWS in the Docker files. | ||
|
|
||
| ## Important Details for the compose file: | ||
|
|
||
| I'm not sure if sqlite needs database user, password, name, port, host, etc, or if we even need a service for it in Docker. I'm relying on the Copilot Agent for guidance on this. | ||
|
|
||
| We need the following ENV variables: | ||
|
|
||
| - ${RAILS_ENV} | ||
| - DOCKER_CONTAINER: true | ||
|
|
||
| ## Definition of Done: | ||
|
|
||
| 1. Successful build of the image from a Dockerfile.dev | ||
| 1. Successful execution of `docker compose up` using our `docker-compose.dev.yml` | ||
| 1. This Rails app is reconfigured to use SQLITE | ||
| 1. A user can `docker exec -it <app_name> /bin/bash` to enter: | ||
|
|
||
| - A container in `development` environment and execute `bin/rails s`, `bin/rails c`. | ||
| - A container in `test` environment and execute `bin/rspec` |
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| services: | ||
| app: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.dev | ||
| args: | ||
| RUBY_VERSION: 4.0.1 | ||
| environment: | ||
| RAILS_ENV: ${RAILS_ENV:-development} | ||
| DOCKER_CONTAINER: "true" | ||
| volumes: | ||
| - ./:/app | ||
| ports: | ||
| - "3000:3000" | ||
| tty: true | ||
| stdin_open: true | ||
| command: ["/bin/bash", "-lc", "bin/rails server -b 0.0.0.0"] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate entry.