-
Notifications
You must be signed in to change notification settings - Fork 51
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
Infra/automated deployment #274
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.
I know you're probably still working on this, but I saw it in my notifications that you'd created this and was excited to take a peek 😁
Just a small suggestion, question, and wanted to mention:
- we probably should include a .Dockerignore file at minimum for the
.git/
directory
Thank you for doing this 🥳 🚀
Co-authored-by: elreydetoda <[email protected]>
Co-authored-by: elreydetoda <[email protected]>
We already have a Thanks for your comments I committed those changes. |
Need to merge in order to test action (you can't test these in isolation on a branch sadly). |
Lol, my bad it was later at night than I thought 😅
Ya, @ironicbadger that's absolutely true (for production), but the Also, since there are no more options for the makefile, because we're forcing everyone to use docker for development (from #249) which is fine but means we need to account for development as well, then we either need another Dockerfile (i.e. Dockerfile.dev) which the makefile builds for the dev step or another solution which allows them to use the hugo serve command. Besides the aforementioned comment I love this PR 😁🥳🚀 |
I made a PR to what I'd mentioned above. Something I did on that Dockerfile.dev that we might want to consider doing on the regular Dockerfile, is I declared an ARG variable which can be passed read during build time. So, we could keep the hugo version defined in the Makefile and it could be passed to both the production container and dev container to keep things in sync and to ensure we're on the same version for both. |
Laying the groundwork for automated production deployments. Comments on methodology welcomed.
The Hugo project does not recommend using the
hugo server
command in production stating that nginx or caddy is their preferred option for these types of deployments. Therefore the Dockerfile was updated to a multi-stage build dropping the usage of the less securehugo server -D
command.The website, once built in
/site/public
in the build stage, is copied in the nginx container and then docker-compose is used on the production VPS instance to auto detect changes and restart the container only if necessary.Multi-stage builds mean that the build happens in a separate container (more secure) and the site remains live for as long as possible. Down the road this will also make automatic PR smoke testing more modular and easier to perform.