Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
Merge pull request #1 from gnoswap-labs/docker-deploy
Browse files Browse the repository at this point in the history
chore: Update Dockerfile and add deployment workflow
  • Loading branch information
jungju authored Jun 20, 2024
2 parents dabe9c6 + a8de6fd commit f42a0ea
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/deploy-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy by create tag

on:
push:
tags:
- '*-beta'

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: development

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to docker registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push image to docker registry
id: build-image
env:
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
REGISTRY_GROUP: gnoswap
REGISTRY_SERVICE: grc20-register
IMAGE_TAG: ${{ github.ref_name }}
run: |
# Build docker images
docker build -t $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG .
docker build -t $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:latest .
# Push images
docker push $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG
docker push $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:latest
echo "image=$REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Redeploy service
uses: actions-hub/kubectl@master
env:
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
REGISTRY_GROUP: gnoswap
IMAGE_TAG: ${{ github.ref_name }}
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_BETA }}
KUBE_DEPLOYMENT_NAME: grc20-register
KUBE_NAMESPACE: beta-gno
with:
args: set image deployment/${{ env.KUBE_DEPLOYMENT_NAME }} container-0=${{ env.REGISTRY_URL }}/${{ env.REGISTRY_GROUP }}/${{ env.KUBE_DEPLOYMENT_NAME }}:${{ env.IMAGE_TAG }} -n ${{ env.KUBE_NAMESPACE }}
46 changes: 46 additions & 0 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy by main push

on:
push:
branches:
- main

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: development

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to docker registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push image to docker registry
id: build-image
env:
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
REGISTRY_GROUP: gnoswap
REGISTRY_SERVICE: grc20-register
IMAGE_TAG: main
run: |
# Build docker images
docker build -t $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG .
# Push images
docker push $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG
echo "image=$REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Redeploy service
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_DEV }}
KUBE_DEPLOYMENT_NAME: grc20-register
KUBE_NAMESPACE: dev-gno
with:
args: rollout restart deployment/${{ env.KUBE_DEPLOYMENT_NAME }} -n ${{ env.KUBE_NAMESPACE }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ FROM scratch
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

COPY --from=builder ["/app/grc20_register", "/app/.env", "/"]
COPY --from=builder ["/app/grc20_register", "/"]

ENTRYPOINT ["/grc20_register", "start"]

0 comments on commit f42a0ea

Please sign in to comment.