Skip to content

Commit

Permalink
Deploy docker images to github container registry (#1836)
Browse files Browse the repository at this point in the history
* Push docker images to github container registry

* Temporarily disable python package build

* Use metadata action to normalize usernames

* Use raw tag for version

* Added opencontainers labels

* Remove temp workarounds

* Update docs

* Add dockerhub deploys
  • Loading branch information
MrNaif2018 committed Oct 5, 2021
1 parent 9c3a8ea commit e8dd6b0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,38 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
- name: Build and publish python package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
twine upload dist/*
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: |
${{ secrets.DOCKERHUB_REPO }}
ghcr.io/${{ github.repository_owner }}/opsdroid
tags: |
type=semver,pattern={{raw}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
8 changes: 4 additions & 4 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ for a list of all the modules you can install this way.

```bash
# Pull the container image
$ docker pull opsdroid/opsdroid:latest
$ docker pull ghcr.io/opsdroid/opsdroid:latest

# Run the container
$ docker run --rm -it -v /path/to/config_folder:/root/.config/opsdroid opsdroid/opsdroid:latest
$ docker run --rm -it -v /path/to/config_folder:/root/.config/opsdroid ghcr.io/opsdroid/opsdroid:latest
```

The default docker image on Docker Hub contains all the module dependencies. To
Expand All @@ -88,7 +88,7 @@ $ docker build --build-arg EXTRAS=.[common] .
$ docker config create OpsdroidConfig /path/to/configuration.yaml

# Create the service
$ docker service create --name opsdroid --config source=OpsdroidConfig,target=/root/.config/opsdroid/configuration.yaml --mount 'type=volume,src=OpsdroidData,dst=/root/.config/opsdroid' opsdroid/opsdroid:latest
$ docker service create --name opsdroid --config source=OpsdroidConfig,target=/root/.config/opsdroid/configuration.yaml --mount 'type=volume,src=OpsdroidData,dst=/root/.config/opsdroid' ghcr.io/opsdroid/opsdroid:latest
```

### Docker Swarm
Expand All @@ -107,7 +107,7 @@ version: "3.5"
services:

opsdroid:
image: opsdroid/opsdroid:latest
image: ghcr.io/opsdroid/opsdroid:latest
networks:
- opsdroid
volumes:
Expand Down
4 changes: 2 additions & 2 deletions docs/maintaining/making-a-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Currently opsdroid builds:

- A Python distribution on [pypi](https://pypi.org/project/opsdroid/)
- A Python distribution on [Conda Forge](https://github.com/conda-forge/opsdroid-feedstock)
- A container image on [Docker Hub](https://hub.docker.com/r/opsdroid/opsdroid/)
- A container image on [Docker Hub](https://hub.docker.com/r/opsdroid/opsdroid/) and [Github container registry](https://github.com/opsdroid/opsdroid/pkgs/container/opsdroid)

The building and distributing is automated by Travis CI and run when a [release is created](https://help.github.com/articles/creating-releases/) on GitHub.

Expand Down Expand Up @@ -52,7 +52,7 @@ This will result in a number of automated actions:

- The new [release tag](https://github.com/opsdroid/opsdroid/tags) will be created on GitHub.
- [Travis CI](https://travis-ci.org/opsdroid/opsdroid) will build the [pypi distribution](https://pypi.python.org/pypi/opsdroid) and upload it.
- [Docker Hub](https://hub.docker.com/r/opsdroid/opsdroid/) will build a new container image, create the [new release tag](https://hub.docker.com/r/opsdroid/opsdroid/tags/) and also update `latest` to point to this release.
- [Docker Hub](https://hub.docker.com/r/opsdroid/opsdroid/) and [Github container registry](https://github.com/opsdroid/opsdroid/pkgs/container/opsdroid) will build a new container image, create the [new release tag](https://hub.docker.com/r/opsdroid/opsdroid/tags/) and also update `latest` to point to this release.
- The @opsdroid [twitter account](https://twitter.com/opsdroid) will tweet that the release has been generated (via [IFTTT](https://ifttt.com)).

There are also the following manual actions which need to be performed:
Expand Down

0 comments on commit e8dd6b0

Please sign in to comment.