Skip to content

Commit

Permalink
Update Docker docsite tooling to generate deploy directory.
Browse files Browse the repository at this point in the history
This change updates the Docker docsite tooling to be able to generate an
easy-to-use deploy directory, resulting in all of the files needed to
update cobalt.dev being generated appropriately from one command.

This change updates the default service on AppEngine to be deployed to
to be the staging service.

b/158002843

Change-Id: I544eebf7ba024d9d24eab3f367ad06912592f4fc
(cherry picked from commit 2667129f609310f96ee58282e306a21bb32410b6)
  • Loading branch information
Cobalt Team committed Mar 12, 2021
1 parent ff35f55 commit 9f6ff1d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
1 change: 1 addition & 0 deletions cobalt/site/deploy/app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
service: staging
runtime: python27
api_version: 1
threadsafe: true
Expand Down
2 changes: 1 addition & 1 deletion docker/docsite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ RUN addgroup --group --gid "${GID}" defaultgroup \

USER defaultuser

CMD /code/third_party/repo-publishing-toolkit-local/preview-site.sh
CMD /cobalt/third_party/repo-publishing-toolkit-local/preview-site.sh
26 changes: 22 additions & 4 deletions docker/docsite/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# How It Works
A Docker container will be launched that will update the cobalt.dev source files
in the Cobalt repository specified by `$COBALT_SRC`, which must be set, and it
will locally host the updated cobalt.dev on port `4000`.
# How To Use
A docker container will be launched that will update the cobalt.dev source files
in the Cobalt repository specified by the environment variable `COBALT_SRC` or
the current working directory, which should be the root of the Cobalt
repository, if that environment variable is not set.

When the `docsite` service is run, the container will then host the updated
cobalt.dev site locally on port `4000`.

When the `docsite-build-only` service is run, the container will build and
output the site content in the directory `out/deploy/www` at the root of the
Cobalt directory, and copy the app.yaml deployable into `out/deploy`.

# How To Run
docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) SERVICE

docker-compose up SERVICE

# Notes

A separate docker-compose.yml was created due to the root docker-compose.yml
being unable to locate the Gemfile in the Docker build context.
Expand All @@ -11,8 +26,11 @@ we need to run `bundle install` with elevated permissions but if we let the
`preview-site.sh`, which normally installs gems, run with elevated permissions
the resulting files added or modified would not be accessible to the user who
ran the Docker container.
<<<<<<< HEAD (6a4768 [PS4] Add logs to debug gpu crash)

# How To Run
docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) docsite

docker-compose up docsite
=======
>>>>>>> CHANGE (266712 Update Docker docsite tooling to generate deploy directory.)
12 changes: 11 additions & 1 deletion docker/docsite/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@ services:
ports:
- "4000:4000"
volumes:
- ${COBALT_SRC:-.}:/code/
# We use ../../ when the environment variable COBALT_SRC is not set since
# this file is located two directories under the root of the repository.
- ${COBALT_SRC:-../../}:/cobalt/
docsite-build-only:
container_name: docsite-build-only
environment:
# SITE_DST specifies where the files required to deploy the site should be
# placed, and by default this is under the "out" directory.
- SITE_DST=/cobalt/out/deploy/www
extends:
service: docsite

0 comments on commit 9f6ff1d

Please sign in to comment.