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

Build docker on PRs, and inline docker GHA config #584

Merged
merged 6 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 41 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,49 @@ name: Docker

on:
push:
branches: ["main"]
tags: ["v*"]
branches: [ main ]

env:
PLATFORMS: "linux/amd64,linux/arm64"

jobs:
build:
name: Build and publish images
uses: "matrix-org/backend-meta/.github/workflows/docker.yml@v1"
with:
image-name: matrixdotorg/sydent
publish: true
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
with:
platforms: ${{ env.PLATFORMS }}
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build main Sydent image
if: github.ref_name == 'main'
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
matrixdotorg/sydent:main

- name: Build release Sydent image
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
id: docker_build_sliding_sync_release
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
matrixdotorg/sydent:latest
matrixdotorg/sydent:${{ github.ref_name }}
16 changes: 16 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ jobs:
packaging:
uses: "matrix-org/backend-meta/.github/workflows/packaging.yml@v1"

docker:
# Sanity check that we can build the x64 image
Copy link
Member

Choose a reason for hiding this comment

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

Just x64 because arm is slow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my thinking, yeah.

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build image
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
push: false

run-tests:
name: Tests
if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COPY --chown=sydent:sydent ["sydent", "sydent"]
COPY --chown=sydent:sydent ["README.rst", "pyproject.toml", "poetry.lock", "./"]

# Install dependencies
RUN python -m poetry install --no-dev --no-interaction --extras "prometheus sentry"
RUN python -m poetry install -vv --no-dev --no-interaction --extras "prometheus sentry"
Copy link
Member

Choose a reason for hiding this comment

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

Do you still want the -vv here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thinking was to leave it in as it can't do any harm.


# Record dependencies for posterity
RUN python -m poetry export -o requirements.txt
Expand Down
1 change: 1 addition & 0 deletions changelog.d/584.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Inline docker job definition in this repo, and update docker-related action versions.
Loading