Skip to content

Add a Docker-based setup. #600

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

Closed
wants to merge 1 commit into from
Closed

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Jan 31, 2023

I can't run Ruby 2.7.x on my machine anymore. Docker was the only solution I found. It may help others getting started to contribute to this website as well.

The setup is basically copied from that of scala-lang.org, but with an additional setup of Node.js.

@sjrd sjrd requested a review from gzm0 January 31, 2023 12:36
Copy link
Contributor

@gzm0 gzm0 left a comment

Choose a reason for hiding this comment

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

A bunch of suggestions for improvements, but for this kind of build, not super critical.


RUN apt install -y curl
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt install -y nodejs
Copy link
Contributor

Choose a reason for hiding this comment

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

We need Node.js as well to build the website?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. We need it for one the plugins, which calls into JS for some reason. I added a comment.

ports:
- '4000:4000'
volumes:
- .:/srv/jekyll
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing the usual UID hackery, have you considered:

  • read-only mounting the sources
  • configure jekyll's build directory away into the docker overlay FS --destination /tmp/jekyll-site

For fully building the website (to deploy), I suggest docker cp

Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, I have no idea what I'm doing. I have 0 Docker knowledge. I copy-pasted from the setup for scala-lang which is at https://github.com/scala/scala-lang/blob/main/docker-compose.yml
This was apparently copied from docs.scala-lang.org to solve some issue, copying changes in scala/docs.scala-lang#2622

🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

:) that's pretty much how this looked 😹

If this is not super urgent, I can make an alternative suggestion (I use docker daily now).

If yes, I'd appreciate a quick description of your deployment process to make sure I'm not making it worse.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not urgent at all. I only use it locally. I can keep it local until there's something good.

The deployment is still working Docker-free in GitHub Actions. It's in https://github.com/scala-js/scala-js-website/blob/main/.github/workflows/deploy.yml

COPY Gemfile.lock .

RUN echo -n "bundle version: " && bundle --version
RUN chmod u+s /bin/chown
Copy link
Contributor

Choose a reason for hiding this comment

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

😨 😨

Dockerfile Outdated
COPY Gemfile .
COPY Gemfile.lock .

RUN echo -n "bundle version: " && bundle --version
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this always be 2.3.10?

Copy link
Member Author

@sjrd sjrd Feb 1, 2023

Choose a reason for hiding this comment

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

Yes, indeed. I guess this was a debug print.

jekyll:
user: "${UID}:${GID}"
build: .
command: sh -c "chown $UID / && echo NODE && node -v && bundle exec jekyll serve --incremental --host=0.0.0.0 "
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need --watch here (like the README.md says)?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would be more consistent, indeed.

I can't run Ruby 2.7.x on my machine anymore. Docker was the only
solution I found. It may help others getting started to contribute
to this website as well.

The setup is basically copied from that of `scala-lang.org`, but
with an additional setup of Node.js.
@sjrd sjrd force-pushed the add-docker-setup branch from 86d7e78 to ef014a0 Compare February 1, 2023 09:09
gzm0 pushed a commit to gzm0/scala-js-website that referenced this pull request Feb 4, 2023
Based off scala-js#600.

I can't run Ruby 2.7.x on my machine anymore. Docker was the only
solution I found. It may help others getting started to contribute
to this website as well.

The setup is inspired by that of `scala-lang.org`, but modified to
avoid UID hacker (instead has some volume hackery).
@gzm0 gzm0 mentioned this pull request Feb 4, 2023
gzm0 pushed a commit to gzm0/scala-js-website that referenced this pull request Feb 4, 2023
Based off scala-js#600.

I can't run Ruby 2.7.x on my machine anymore. Docker was the only
solution I found. It may help others getting started to contribute
to this website as well.

The setup is inspired by that of `scala-lang.org`, but modified to
avoid UID hackery (instead has some volume hackery).
@gzm0
Copy link
Contributor

gzm0 commented Feb 4, 2023

Alternative: #601.

@sjrd
Copy link
Member Author

sjrd commented Feb 6, 2023

Superseded by #601.

@sjrd sjrd closed this Feb 6, 2023
@sjrd sjrd deleted the add-docker-setup branch February 6, 2023 09:23
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.

2 participants