-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add Dockerfile #291
Add Dockerfile #291
Conversation
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.
Looks good overall! Can you add some docs on this in the README?
################################## | ||
# Build | ||
################################## | ||
FROM node:14 as build |
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.
Curious: what does the as build
syntax do here? I have some familiarity with Docker but haven't seen this before.
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.
It is for multi-stage builds. See: https://docs.docker.com/develop/develop-images/multistage-build/
These are useful for controlling the number of layers in the final image and also for controlling the contents of the image itself. Most of the time, the tools necessary at build time are not necessary at runtime. Using a multi-stage build allows us to leave the compiler toolchains behind and not include them in the final image.
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.
Ah, I suspected as much. Thanks for the speedy response!
@groodt Thank you for this! I'm running into an issue configuring a non-default (non-4000) port. For example, using port 4200, passing
nor does passing
but when I pass them in both it works:
|
@mrtns My pleasure. I'm actually running this in production at the moment and it seems to work really well! I've found the issue that requires 2 ports to be set: This line: Line 139 in 146a5eb
combined with this line: will cause I'll update this PR to not set the PORT. I'll also raise a PR to simplify the PORT variable logic to a single variable. |
@mrtns This PR now works when only setting
Or build the image yourself:
|
@captainsafia I've added some notes to the Do I need to do anything to merge this, or is this not going to be merged? |
It's good to merge. I was just waiting for the README updates. |
Adds a Dockerfile for running commuter in a production environment
There is an old PR still open for adding simple Docker support, but that appears more suitable for local development: #188
This PR is intended to build a Docker container suitable for publishing to Dockerhub (or other registry) and be run in a production environment such as Kubernetes.
It can be tested locally as follows:
or (use my prebuilt image)