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

- switch beta to Blumilk's docker registry #432

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 14 additions & 9 deletions .github/workflows/deploy-to-beta-manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
name: Deploy to beta
runs-on: ubuntu-22.04
env:
REPO_NAME: toby
DOCKER_REGISTRY: registry.blumilk.pl
DOCKER_REGISTRY_USER_NAME: robot@blumilkbot-harbor
DOCKER_REGISTRY_PROJECT_NAME: ${{ github.event.repository.name }}
steps:
- name: set branch name
run: echo "BRANCH_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV
Expand All @@ -40,15 +42,18 @@ jobs:
- name: login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_REGISTRY_USER_NAME }}
password: ${{ secrets.BLUMILKBOT_HARBOR_TOKEN }}

- name: set docker image name
run: echo "DOCKER_IMAGE_NAME=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REGISTRY_PROJECT_NAME }}/${{ env.DOCKER_REGISTRY_PROJECT_NAME }}" >> $GITHUB_ENV

- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: type=raw,value=beta
context: git

Expand All @@ -59,10 +64,10 @@ jobs:
file: ./environment/prod/app/Dockerfile
build-args: DEPLOYMENT_PROJECT_VERSION_ARG=${{ env.DEPLOYMENT_PROJECT_VERSION }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}:beta
cache-from: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}-beta-build-cache
cache-to: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}-beta-build-cache, mode=max
cache-from: type=gha, ref=${{ env.DOCKER_IMAGE_NAME }}-beta-build-cache
cache-to: type=gha, ref=${{ env.DOCKER_IMAGE_NAME }}-beta-build-cache, mode=max

- name: copy files via ssh
uses: appleboy/[email protected]
Expand Down Expand Up @@ -92,4 +97,4 @@ jobs:
script: |
cd ${{ secrets.TOBY_VPS_BETA_APP_PATH }}/environment/prod/deployment/beta
make beta-deploy SOPS_AGE_KEY=${{ secrets.SOPS_AGE_BETA_SECRET_KEY }}
docker images --filter dangling=true | grep "ghcr.io/blumilksoftware/${{ env.REPO_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi
docker images --filter dangling=true | grep "${{ env.DOCKER_IMAGE_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi
25 changes: 14 additions & 11 deletions .github/workflows/deploy-to-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
runs-on: ubuntu-22.04
name: Deploy to production
env:
REPO_NAME: toby
DOCKER_REGISTRY: registry.blumilk.pl
DOCKER_REGISTRY_USER_NAME: robot@blumilkbot-harbor
DOCKER_REGISTRY_PROJECT_NAME: ${{ github.event.repository.name }}
steps:
- name: checkout
uses: actions/[email protected]
Expand All @@ -29,15 +31,18 @@ jobs:
- name: login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_REGISTRY_USER_NAME }}
password: ${{ secrets.BLUMILKBOT_HARBOR_TOKEN }}

- name: set docker image name
run: echo "DOCKER_IMAGE_NAME=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REGISTRY_PROJECT_NAME }}/${{ env.DOCKER_REGISTRY_PROJECT_NAME }}" >> $GITHUB_ENV

- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=raw,value=latest
type=raw,value=${{ github.ref_name }}
Expand All @@ -50,12 +55,10 @@ jobs:
file: ./environment/prod/app/Dockerfile
build-args: DEPLOYMENT_PROJECT_VERSION_ARG=${{ env.DEPLOYMENT_PROJECT_VERSION }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}:latest
ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}:${{ github.ref_name }}
cache-from: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}-prod-build-cache
cache-to: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}-prod-build-cache, mode=max
cache-from: type=gha, ref=${{ env.DOCKER_IMAGE_NAME }}-prod-build-cache
cache-to: type=gha, ref=${{ env.DOCKER_IMAGE_NAME }}-prod-build-cache, mode=max

- name: copy files via ssh
uses: appleboy/[email protected]
Expand Down Expand Up @@ -84,4 +87,4 @@ jobs:
script: |
cd ${{ secrets.TOBY_VPS_LIVE_APP_PATH }}/environment/prod/deployment/prod
make prod-deploy SOPS_AGE_KEY=${{ secrets.SOPS_AGE_PROD_SECRET_KEY }}
docker images --filter dangling=true | grep "ghcr.io/blumilksoftware/${{ env.REPO_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi
docker images --filter dangling=true | grep "${{ env.DOCKER_IMAGE_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi
2 changes: 1 addition & 1 deletion environment/prod/deployment/beta/docker-compose.beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ volumes:

services:
toby-beta-app:
image: ghcr.io/blumilksoftware/toby:beta
image: registry.blumilk.pl/toby/toby:beta
container_name: toby-beta-app
pull_policy: always
deploy:
Expand Down
2 changes: 1 addition & 1 deletion environment/prod/deployment/prod/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ volumes:

services:
toby-prod-app:
image: ghcr.io/blumilksoftware/toby:latest
image: registry.blumilk.pl/toby/toby:latest
container_name: toby-prod-app
pull_policy: always
deploy:
Expand Down
14 changes: 14 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ Application will be running under [localhost:8751](localhost:8751) and [http://t
| `make cs` | Runs codestyle checks |
| `make fix` | Runs codestyle fixers |

### Docker image

App images will be accessible under the following tags:

Beta:
- `registry.blumilk.pl/toby/toby:beta`

Production image will be accessible in the new registry since `v1.2.1` tag.

Prod:
- `registry.blumilk.pl/toby/toby:latest`
- `registry.blumilk.pl/toby/toby:v1.2.3` (depends on releases/tags)


### Further reading
* [Xdebug configuration](./readme.xdebug.md)
* [sops configuration](./readme.sops.md)
Loading