web-platform-tests / wpt.fyi

web-platform-tests dashboard
https://wpt.fyi/
Other
188 stars 90 forks source link

Consider using a separate docker container between the app and development environment #4029

Open jcscottiii opened 3 weeks ago

jcscottiii commented 3 weeks ago

Background

Currently, we have three Dockerfiles:

  1. https://github.com/web-platform-tests/wpt.fyi/blob/main/Dockerfile
  2. https://github.com/web-platform-tests/wpt.fyi/blob/main/api/query/cache/service/Dockerfile
  3. https://github.com/web-platform-tests/wpt.fyi/blob/main/results-processor/Dockerfile

Dockerfile 1 provides an environment with consistent tools so that we can build the main webapp service. But the deployment of the webapp does not use Dockerfile when running. Like the other two services. Instead, it relies on buildpacks to build the executable on deploy. Dockerfile 2 builds the image for the search cache service Dockerfile 3 builds the image for the results processor service.

Problem

Sometimes when we upgrade Dockerfile 1, the PR is unable to deploy the webapp. This is mainly due to the fact the deployment always pulls from the :latest tag instead of the newly built image tag for that PR.

Suggestion

Make Dockerfile 2 a common Go Dockerfile that both search cache and the webapp use. And we can use Dockerfile arguments to specify at build time which binary to build in this Go Dockerfile. (Can look at this Dockerfile for inspiration. It should be simpler since we don't use multiple Go modules). After doing this, we would need to change the runtime in both prod and staging app.yaml files from go1xx to custom like we do for the search cache service.

Out of scope for this issue but something to consider in a separate issue

Should the Dockerfile in the root of the repository be changed to use devcontainer

jcscottiii commented 3 weeks ago

Actually this may not be as straight forward:

https://issuetracker.google.com/issues/286782972

App Engine does not currently support passing the build argument. Instead, there's a workaround.