-
Notifications
You must be signed in to change notification settings - Fork 5
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
🐳 Docker images #59
Merged
🐳 Docker images #59
Conversation
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
The default database.yml supports multiple environments because often there are multiple databases involved in a web application instance, specially on local development machines, where you often have the _development and the _test database. However, when the application runs through Docker, an alternative approach is used and instead of multiple instances, there is a single database instance.
This commit will add a docker-compose.yml file that can be used to run the application in a development environment. Note that the application has not been tested to be suitable for testing environments yet. The docker-compose is not valid for production environments because it mounts the entire code as a volume.
Docker doesn't seem to properly clean-up the Rails application when it stops, so the remaining server.pid confuses Rails the very next time it starts up.
This reduces the overall image size.
After removing node_modules/ in my host directory, I noticed that the application stopped working inside the container. Apparently, because I'm mounting . into the container, it doesn't matter the Dockerfile runs yarn install: the node_modules directory in the container gets hidden when the whole application directory is replaced by the root contents. That means that it's still required to run yarn install on the host to make node_modules be available in the container. To avoid this, the volume-in-volume Docker trick is added in this commit, by using information described in this article here [1]. Container's node_modules directory is remounted after binding the application directory. This makes the original /makigas/node_modules directory available, even if the host system doesn't have this directory. This trick is also used as a workaround to replace tmpfs introduced in commit de9c93f with a local and persistent mounting point that survive stopping and restarting the container. [1]: http://jdlm.info/articles/2016/03/06/lessons-building-node-app-docker.html#the-node_modules-volume-trick
MAINTAINER is deprecated. Replace with LABEL. Plus, CMD is back to the Dockerfile. To avoid the testing setup to run a Rails server, it overrides the command so that instead of spawning a server it just runs /bin/true. It works the same.
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is used to create and test Docker images. The PR will be merged once there is a stable Docker image that works on development and testing environments. It might be possible to modify the built Docker image so that it can be used in production environments but it will be outside of the scope of this PR because I don't know what can I expect from it.
Tasks
Other things to look
Tracking Issue
Assigned tracking issue for this feature is #52.