Add CI for publishing docker image (#3)
All checks were successful
Publish azimuth-watcher docker image on release / Run docker build and publish (release) Successful in 2m5s
All checks were successful
Publish azimuth-watcher docker image on release / Run docker build and publish (release) Successful in 2m5s
Reviewed-on: #3 Co-authored-by: Nabarun <nabarun@deepstacksoft.com> Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
This commit is contained in:
parent
08f08316cb
commit
914b71c98a
29
.gitea/workflows/docker-image.yml
Normal file
29
.gitea/workflows/docker-image.yml
Normal file
@ -0,0 +1,29 @@
|
||||
name: Publish azimuth-watcher docker image on release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Run docker build and publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run docker build
|
||||
run: docker build -t cerc/watcher-azimuth -f Dockerfile .
|
||||
- name: Get the version
|
||||
id: vars
|
||||
run: |
|
||||
echo "sha=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_OUTPUT
|
||||
echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
|
||||
- name: Tag docker image with SHA
|
||||
run: docker tag cerc/watcher-azimuth git.vdb.to/laconicnetwork/cerc/watcher-azimuth:${{steps.vars.outputs.sha}}
|
||||
- name: Tag docker image with release tag
|
||||
run: docker tag git.vdb.to/laconicnetwork/cerc/watcher-azimuth:${{steps.vars.outputs.sha}} git.vdb.to/laconicnetwork/cerc/watcher-azimuth:${{steps.vars.outputs.tag}}
|
||||
- name: Docker Login
|
||||
run: echo ${{ secrets.CICD_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u laconiccicd --password-stdin
|
||||
- name: Docker Push SHA
|
||||
run: docker push git.vdb.to/laconicnetwork/cerc/watcher-azimuth:${{steps.vars.outputs.sha}}
|
||||
- name: Docker Push TAGGED
|
||||
run: docker push git.vdb.to/laconicnetwork/cerc/watcher-azimuth:${{steps.vars.outputs.tag}}
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM node:18.16.0-alpine3.16
|
||||
|
||||
RUN apk --update --no-cache add git python3 alpine-sdk jq
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
# Get the latest Git commit hash and set it in package.json of all watchers
|
||||
RUN COMMIT_HASH=$(git rev-parse HEAD) && \
|
||||
find . -name 'package.json' -exec sh -c ' \
|
||||
for packageFile; do \
|
||||
jq --arg commitHash "$0" ".commitHash = \$commitHash" "$packageFile" > "$packageFile.tmp" && \
|
||||
mv "$packageFile.tmp" "$packageFile"; \
|
||||
done \
|
||||
' "$COMMIT_HASH" {} \;
|
||||
|
||||
RUN echo "installing dependencies" && \
|
||||
yarn
|
||||
|
||||
RUN echo "Building azimuth-watcher and gateway-server" && \
|
||||
yarn build --scope @cerc-io/azimuth-watcher --scope @cerc-io/gateway-server
|
||||
|
||||
RUN echo "Install toml-js to update watcher config files" && \
|
||||
yarn add --dev --ignore-workspace-root-check toml-js
|
@ -3,6 +3,6 @@
|
||||
"packages/*"
|
||||
],
|
||||
"useWorkspaces": true,
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"npmClient": "yarn"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cerc-io/azimuth-watcher",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"description": "azimuth-watcher",
|
||||
"private": true,
|
||||
"main": "dist/index.js",
|
||||
|
Loading…
Reference in New Issue
Block a user