Skip to content
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 #432

Merged
merged 14 commits into from Oct 18, 2019
Merged

Add dockerfile #432

merged 14 commits into from Oct 18, 2019

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Oct 11, 2019

I went over this with @pietroalbini in Discord - Since the Vagrantfile is out of date, it's hard to build docs.rs locally. This pull allows anyone with docker-compose installed to get started as fast as they can build the crates.

Overview

Most of the build happens in the Dockerfile and is cached. The only changes that happen after the docker container starts are building the documentation for each crate (which is cached, since it's stored in the mounted Rustwide volume) and performing the database migrations, which are cached in practice since no one will be deleting the database container for the fun of it.

The webserver does run as root in the docker container, which rustwide requires in order to be able to communicate with docker. Although we could add the cratesfyi user to the docker group, there's no way to make sure that the mounted docker socket in the container has the same GID as the host.

Changes

  • Adds --foreground flag for cratesfyi daemon (needed for docker)
  • Adds CSS files to git. Not sure if there's another way these are managed, since there are timestamps on each CSS file. Additionally, I'm not sure I got them all, I basically just clicked around until I stopped getting 404 errors.
  • The server now listens on 0.0.0.0 when it can't determine a hostname, not 127.0.0.1

The build actually finishes!
Also set environment variables, mount rustwide workspace
only mark sources as out of date, not dependencies
it will get build anyway when the server runs builds in the background
and this makes it easier for development
The container is running things as root anyway in order to be able to
communicate with docker
@pietroalbini pietroalbini self-assigned this Oct 15, 2019
Copy link
Member

@pietroalbini pietroalbini left a comment

Choose a reason for hiding this comment

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

Tested this locally and it works great! Left a few comments though.

css/queue Outdated Show resolved Hide resolved
css/main-20191010-1.40.0-nightly-898f36c83.js.1 Outdated Show resolved Hide resolved
css/source-script-20191010-1.40.0-nightly-898f36c83.js.1 Outdated Show resolved Hide resolved
css/style.css?0.6.0-4419dc8-2019-10-11 Outdated Show resolved Hide resolved
css/settings-20191010-1.40.0-nightly-898f36c83.js.1 Outdated Show resolved Hide resolved
docker-entrypoint.sh Outdated Show resolved Hide resolved
jyn514 and others added 2 commits October 17, 2019 18:29
Co-Authored-By: Pietro Albini <pietro@pietroalbini.org>
@jyn514
Copy link
Member Author

jyn514 commented Oct 17, 2019

Removed the duplicate files, thanks for the review!

@pietroalbini
Copy link
Member

Thanks for making this!

@pietroalbini pietroalbini merged commit b0c43d1 into rust-lang:master Oct 18, 2019
@jyn514 jyn514 deleted the docker-in-docker branch November 5, 2019 16:15
@jyn514 jyn514 mentioned this pull request Dec 12, 2019
@jyn514 jyn514 added the A-builds Area: Building the documentation for a crate label Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants