Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(IDX): create minimal image #682

Merged
merged 22 commits into from
Jul 31, 2024
20 changes: 20 additions & 0 deletions .github/minimal-runner-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:20.04

RUN apt -yq update && \
apt -yq install --no-install-recommends git curl wget ca-certificates sudo build-essential jq xxd

RUN groupadd -g 1001 runner && useradd -ms /bin/bash -u 1001 -g 1001 runner && \
echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER runner

# Set PATH for runner user
ENV PATH=/ic/bin:/home/runner/.cargo/bin:/home/runner/.local/bin:$PATH

# Install rustup and cargo
ARG RUST_VERSION=1.79.0
RUN curl --fail https://sh.rustup.rs -sSf \
| sh -s -- -y --default-toolchain ${RUST_VERSION}-x86_64-unknown-linux-gnu --no-modify-path && \
rustup default ${RUST_VERSION}-x86_64-unknown-linux-gnu

CMD ["/bin/bash"]
1 change: 1 addition & 0 deletions .github/minimal-runner-image/TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1
43 changes: 43 additions & 0 deletions .github/workflows/build-minimal-runner-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build Minimal Runner Image

on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/build-minimal-runner-image.yml'
- '.github/minimal-runner-image/**'

permissions:
contents: read
packages: write

jobs:
build-and-upload-minimal-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@a530e948adbeb357dbca95a7f8845d385edf4438 # v3

- name: Login to GHCR
uses: docker/login-action@5f4866a30a54f16a52d2ecb4a3898e9e424939cf # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Determine TAG
id: tag
run: |
echo "TAG=$(cat ${{ github.workspace }}/.github/minimal-runner-image/TAG)" >> $GITHUB_ENV

- name: Build and push image
uses: docker/build-push-action@eb539f44b153603ccbfbd98e2ab9d4d0dcaf23a4 # v5
with:
context: ${{ github.workspace}}/.github/minimal-runner-image
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/minimal-runner-image:${{ env.TAG }}
ghcr.io/${{ github.repository_owner }}/minimal-runner-image:latest