Update a service
Use Duplo to update a service's container from Github Actions
The goal of this section is to show how you can update the docker image for a service, after you have built that image.
This example makes some assumptions:
- Your workflow already has a
build
job - we created one in the previous section - Your
build
job declares an output namedimage
- also done in the previous section
To use it you will need to change:
duplo_host
env varSERVICE_NAME
env varTENANT_NAME
env var
name: Build and Deploy
on:
# (Optional) Allows users to trigger the workflow manually from the GitHub UI
workflow_dispatch:
# Triggers the workflow on push to matching branches
push:
branches:
- master
env:
duplo_host: https://mysystem.duplocloud.net # CHANGE ME!
duplo_token: "${{ secrets.DUPLO_TOKEN }}"
SERVICE_NAME: myservice # CHANGE ME!
TENANT_NAME: mytenant # CHANGE ME!
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# YOU SHOULD ALREADY HAVE THIS FROM THE PREVIOUS DOCUMENTATION SECTION
# ...
# ...
deploy:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/[email protected]
# Update the backend service to use the new image.
- name: Deploy
uses: duplocloud/ghactions-service-[email protected]
with:
tenant: "${{ env.TENANT_NAME }}"
services: |-
[
{ "Name": "${{ env.SERVICE_NAME }}", "Image": "${{ needs.build.outputs.image }}" }
]
Last modified 18d ago