-
Couldn't load subscription status.
- Fork 31
Overhaul the Docker setup #117
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
Open
ldionne
wants to merge
7
commits into
llvm:main
Choose a base branch
from
ldionne:review/overhaul-docker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bf32c5c
Overhaul the Docker setup
ldionne 428e827
Try using a mount instead of copying sources
ldionne 45e71f9
Use set -u to simplify docker entrypoint
ldionne 1bd2b5d
Try installing with mount, take 2
ldionne 8d4cce1
Undo secrets changes
ldionne eea12a8
Downgrade everything to environment variables
ldionne 0761f90
Use secrets, again
ldionne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # This file composes a full service running LNT. A LNT service is comprised | ||
| # of a container running a Postgres database and a container running a | ||
| # production LNT webserver. | ||
| # | ||
| # In order to build the full service, some secrets are required. They are taken | ||
| # as environment variables, which means they can be stored in a file and included | ||
| # via `--env-file <secrets-file>`. These environment variables are: | ||
| # | ||
| # LNT_DB_PASSWORD | ||
| # The password to use for logging into the database. | ||
| # | ||
| # LNT_AUTH_TOKEN | ||
| # The authentication token used to require authentication to | ||
| # perform destructive actions. | ||
|
|
||
| name: llvm-lnt | ||
|
|
||
| services: | ||
| webserver: | ||
| container_name: webserver | ||
| build: | ||
| context: ../ | ||
| dockerfile: docker/lnt.dockerfile | ||
| environment: | ||
| - DB_USER=lntuser | ||
| - DB_HOST=dbserver | ||
| - DB_NAME=lnt.db | ||
| - DB_PASSWORD_FILE=/run/secrets/lnt-db-password | ||
| - AUTH_TOKEN_FILE=/run/secrets/lnt-auth-token | ||
| secrets: | ||
| - lnt-db-password | ||
| - lnt-auth-token | ||
| depends_on: | ||
| - db | ||
| deploy: | ||
| restart_policy: | ||
| condition: on-failure | ||
| ports: | ||
| - "8000:8000" | ||
| volumes: | ||
| - instance:/var/lib/lnt | ||
| - logs:/var/log/lnt | ||
ldionne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| db: | ||
| container_name: dbserver | ||
| image: docker.io/postgres:18-alpine | ||
| environment: | ||
| - POSTGRES_PASSWORD_FILE=/run/secrets/lnt-db-password | ||
| - POSTGRES_USER=lntuser | ||
| - POSTGRES_DB=lnt.db | ||
| secrets: | ||
| - lnt-db-password | ||
| volumes: | ||
| - database:/var/lib/postgresql | ||
|
|
||
| volumes: | ||
| instance: | ||
| logs: | ||
| database: | ||
|
|
||
| secrets: | ||
| lnt-db-password: | ||
| environment: "LNT_DB_PASSWORD" | ||
| lnt-auth-token: | ||
| environment: "LNT_AUTH_TOKEN" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # This Dockerfile defines an image that contains a production LNT server. | ||
| # This image is intended to be built from a Docker Compose file, as it | ||
| # requires additional information passed as environment variables: | ||
| # | ||
| # DB_USER | ||
| # The username to use for logging into the database. | ||
| # | ||
| # DB_HOST | ||
| # The hostname to use to access the database. | ||
| # | ||
| # DB_NAME | ||
| # The name of the database on the server. | ||
| # | ||
| # DB_PASSWORD_FILE | ||
| # File containing the password to use for logging into the database. | ||
| # | ||
| # AUTH_TOKEN_FILE | ||
| # File containing the authentication token used to require authentication | ||
| # to perform destructive actions. | ||
|
|
||
| FROM python:3.10-alpine | ||
|
|
||
| # Install dependencies | ||
| RUN apk update \ | ||
| && apk add --no-cache --virtual .build-deps git g++ postgresql-dev yaml-dev \ | ||
| && apk add --no-cache libpq | ||
|
|
||
| # Install LNT itself, without leaving behind any sources inside the image. | ||
| RUN --mount=type=bind,source=.,target=./lnt-source \ | ||
| cp -R lnt-source /tmp/lnt-src && \ | ||
| cd /tmp/lnt-src && \ | ||
| pip3 install -r requirements.server.txt && apk --purge del .build-deps && \ | ||
| rm -rf /tmp/lnt-src | ||
|
|
||
| # Prepare volumes that will be used by the server | ||
| VOLUME /var/lib/lnt /var/log/lnt | ||
|
|
||
| # Set up the actual entrypoint that gets run when the container starts. | ||
| COPY docker/docker-entrypoint.sh docker/lnt-wait-db /usr/local/bin/ | ||
| ENTRYPOINT ["docker-entrypoint.sh"] | ||
| EXPOSE 8000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.