diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml new file mode 100644 index 00000000..c5967b44 --- /dev/null +++ b/.github/workflows/dockerimage.yml @@ -0,0 +1,68 @@ +name: Build and Deploy Helios Docker Image + +on: + push: + branches: + - master + +permissions: + contents: read + packages: write + +jobs: + build-docker: + runs-on: ubuntu-latest + name: Build Docker Image + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Define docker image meta data tags + id: meta + uses: docker/metadata-action@v5 + with: + images: | + obolnetwork/helios + ghcr.io/obolnetwork/helios + tags: | + type=sha,prefix= + type=raw,value=latest + + - name: Login to Github container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to Dockerhub container registry + uses: docker/login-action@v3 + with: + username: obolnetwork + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + build-args: GITHUB_SHA=${{ github.sha }} + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..c584316c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:24.04 + +# Install curl +RUN apt-get update && apt-get install -y \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Create non-root user +RUN useradd -m -s /bin/bash helios + +# Switch to non-root user +USER helios +WORKDIR /home/helios + +# Set environment variable for helios +ENV PATH="/home/helios/.helios/bin:${PATH}" + +# Install heliosup first, then use it to install helios +RUN curl -fsSL https://raw.githubusercontent.com/a16z/helios/master/heliosup/install | bash && \ + /bin/bash -c 'heliosup' + +# Set a default entrypoint +ENTRYPOINT ["helios"] \ No newline at end of file