Skip to content

Commit

Permalink
Merge pull request #34 from celo-org/jcortejoso/celocli-container
Browse files Browse the repository at this point in the history
Celocli standalone container image
  • Loading branch information
lvpeschke authored Jan 11, 2024
2 parents 1d052c7 + 556c329 commit 13202e1
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Build containers

on:
release:
types:
- "published"

jobs:
split-version:
runs-on: ['ubuntu-latest']
# if: |
# contains(github.event.release.name, '@celo/celocli')
outputs:
CELOCLI_VERSION: ${{ steps.split.outputs.CELOCLI_VERSION }}
steps:
- name: Split celocli-version
id: split
shell: bash
run: |
CELOCLI_VERSION="$(${{ github.event.release.name }}##*@)"
echo "CELOCLI_VERSION=$CELOCLI_VERSION" >> $GITHUB_OUTPUT
# CeloCli standalone image
celocli-standalone:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/dev-images/celocli:${{ needs.split-version.outputs.CELOCLI_VERSION }}
needs: ['split-version']
# if: |
# contains(github.event.release.name, '@celo/celocli')
with:
workload-id-provider: projects/1094498259535/locations/global/workloadIdentityPools/gh-developer-tooling/providers/github-by-repos
service-account: '[email protected]'
artifact-registry: us-west1-docker.pkg.dev/devopsre/developer-tooling/celocli
tags: ${{ needs.split-version.outputs.CELOCLI_VERSION }}
context: .
file: packages/cli/standalone.Dockerfile
build-args: VERSION=${{ needs.split-version.outputs.CELOCLI_VERSION }}
trivy: true
29 changes: 29 additions & 0 deletions packages/cli/standalone.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Docker image containing the celocli, built from NPM.
#
# Example build command (manual):
#
# VERSION=x.y.z; docker build . --build-arg VERSION=$VERSION -t celocli-standalone:$VERSION
FROM node:20-alpine
LABEL org.opencontainers.image.authors="[email protected]"

# Install cli install dependencies.
RUN apk add --no-cache python3 git make gcc g++ bash libusb-dev linux-headers eudev-dev

# Add an set as default a non-privileged user named celo.
RUN adduser -D -S celo
USER celo

# Make folders for npm packages.
RUN mkdir /home/celo/.npm-global
ENV PATH=/home/celo/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/celo/.npm-global

WORKDIR /home/celo/

# Install @celo/celocli from NPM.
ARG VERSION
RUN npm install -g @celo/celocli@$VERSION
RUN celocli config:set --node https://forno.celo.org

ENTRYPOINT ["celocli"]
CMD ["--help"]

0 comments on commit 13202e1

Please sign in to comment.