-
Notifications
You must be signed in to change notification settings - Fork 0
ci: build Docker image and push to registry from applicative's CI #98
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
af2b9c2
fix(ci): run publish only on tag or push on main, run lint/tests/buil…
bolinocroustibat e024a22
build: add Dockerfile
bolinocroustibat b8167aa
ci: refactor CI to build on main, send to docker registry, and publis…
bolinocroustibat 144e52f
ci: tag docker image the same way we tag release
bolinocroustibat d6b51ae
build: also build Metrics API
bolinocroustibat c72157e
build: update docker compose
bolinocroustibat 61aefa1
docs: update README
bolinocroustibat b0e8d75
ci: build/publish to docker registry only when publishing to PyPi
bolinocroustibat e98ebdf
ci: fix docker login
bolinocroustibat 5189b69
Merge branch 'main' into feat/build-in-ci
bolinocroustibat 5b7d718
ci(docker): push multiple image tags and use docker-repo parameters
bolinocroustibat 18caa56
build: fix ownership issue in dockerfile
bolinocroustibat 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 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,29 @@ | ||
| FROM astral/uv:python3.11-trixie-slim | ||
|
|
||
| # Which app to run (e.g. api_tabular.tabular.app:app_factory or api_tabular.metrics.app:app_factory) | ||
| ARG APP_MODULE=api_tabular.tabular.app:app_factory | ||
|
|
||
| # install needed apt packages | ||
| RUN apt-get update -y && \ | ||
| apt-get install -y --no-install-recommends git && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # create user & group | ||
| RUN groupadd --system datagouv && \ | ||
| useradd --system --gid datagouv --create-home datagouv | ||
|
|
||
| # install | ||
| WORKDIR /home/datagouv | ||
| ADD . /home/datagouv/ | ||
| # setuptools_scm runs git during install; Git refuses a repo whose owner differs from the build user (root). | ||
| RUN git config --global --add safe.directory /home/datagouv | ||
| RUN uv sync --frozen | ||
| RUN chown -R datagouv:datagouv /home/datagouv | ||
|
|
||
| # run (ENV from ARG so shell can expand APP_MODULE at runtime) | ||
| USER datagouv | ||
| ENV APP_MODULE=${APP_MODULE} | ||
| # Use `python -m gunicorn` instead of `gunicorn` due to uv issue #15246: https://github.com/astral-sh/uv/issues/15246 | ||
| # Shell so APP_MODULE is expanded; bind to 8005 (map to different host ports when running both containers) | ||
| ENTRYPOINT ["/bin/sh", "-c"] | ||
| CMD ["uv run python -m gunicorn $APP_MODULE --bind 0.0.0.0:8005 --worker-class aiohttp.GunicornWebWorker --workers 2 --access-logfile -"] |
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
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.