Skip to content

Add Docker deployment #175

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 2 commits into from
Mar 14, 2023
Merged

Add Docker deployment #175

merged 2 commits into from
Mar 14, 2023

Conversation

artemmukhin
Copy link
Member

No description provided.

</list>
</option>
<option name="sourceFilePath" value="Dockerfile" />
<option name="volumeBindings">
Copy link
Member

@Undin Undin Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand, volumes here are needed to be able to apply changes made locally without rerunning configuration. But why only _posts and assets/posts/ directories? What if I want to change some other places? Maybe it's better to add volume for the whole project directory instead of copying its files during docker image building?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trick here is to preserve Gemfile and Gemfile.lock that were patched during the image build. I couldn't find a better way to do that, but if you know one – please share it.

As we can see at https://pages.github.com/versions, GitHub uses Ruby 2.7.4. But I cannot deploy the website locally using this Ruby version on my ARM-based machine because of some dependencies incompatibilities. That's why my Dockerfile uses a newer Ruby version and thus has to patch the gem dependencies to make it work.

I've extended the list of directories: _posts/, assets/, _docs/, _includes/. They seem to be the most important directories for changes to be auto-applied.

And by @vlad20012 advice, I've added all of them to .dockerignore not to do the useless job, and I've also fixed the Ruby version to avoid incompatibilities in the future.

@artemmukhin
Copy link
Member Author

@vlad20012 Thanks for the careful review!

Reduce the image size to 1Gb,
 mount `_site` for better caching,
 reduce the number of docker image layers
@vlad20012 vlad20012 assigned artemmukhin and unassigned vlad20012 Mar 14, 2023
@artemmukhin artemmukhin merged commit 559b74c into master Mar 14, 2023
@Undin Undin deleted the add-dockerfile branch March 14, 2023 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants