From 54916377036a3d698a05f9db077316dab863184c Mon Sep 17 00:00:00 2001 From: Pranav Date: Fri, 10 Oct 2025 16:19:53 +0530 Subject: [PATCH] Create docker file and ci to publish image on release --- .github/workflows/docker-image.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 29 +++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker-image.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..4285f15b --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,29 @@ +name: Publish cosmos-explorer 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/cosmos-explorer -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/cosmos-explorer git.vdb.to/laconicnetwork/cerc/cosmos-explorer:${{steps.vars.outputs.sha}} + - name: Tag docker image with release tag + run: docker tag git.vdb.to/laconicnetwork/cerc/cosmos-explorer:${{steps.vars.outputs.sha}} git.vdb.to/laconicnetwork/cerc/cosmos-explorer:${{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/cosmos-explorer:${{steps.vars.outputs.sha}} + - name: Docker Push TAGGED + run: docker push git.vdb.to/laconicnetwork/cerc/cosmos-explorer:${{steps.vars.outputs.tag}} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a08e776c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster +ARG VARIANT=20-bullseye + +# Build stage +FROM node:${VARIANT} AS builder + +WORKDIR /app + +COPY . . +RUN yarn install +RUN yarn build + +# Production stage +FROM node:${VARIANT}-slim AS production + +# Create app directory +WORKDIR /app + +# Copy built application from builder stage +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/yarn.lock ./yarn.lock + +# Install only production dependencies +RUN yarn install --production + +# Expose port for http +EXPOSE 4173 diff --git a/package.json b/package.json index e4f50215..f28278af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ping.pub", - "version": "3.0.0", + "version": "3.0.0-zenith-0.1.0", "private": true, "target": "", "scripts": {