Skip to content

Commit

Permalink
Try round one
Browse files Browse the repository at this point in the history
  • Loading branch information
jatsrt committed Feb 2, 2024
1 parent 734010b commit 2bfcda0
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github
43 changes: 43 additions & 0 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Create and publish Docker runner image

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push0image:
runs-on: runner-set-dind

permissions:
packages: write
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM ghcr.io/actions/actions-runner:latest

ARG TARGETOS
ARG TARGETARCH
ARG ZIG_VERSION=0.11.0
ARG CARGO_LAMBDA_VERSION=1.0.3

# Install base packages
RUN sudo apt update -y \
&& sudo apt install -y curl wget tar xz-utils unzip build-essential

# Install GH CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update && sudo apt install -y gh

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
ENV PATH="/home/runner/.cargo/bin:${PATH}"

RUN rustup target add aarch64-unknown-linux-musl \
&& rustup toolchain add nightly

RUN cargo install --locked cargo-lambda@${CARGO_LAMBDA_VERSION}

# Install Zig
RUN export RUNNER_ARCH=${TARGETARCH} \
&& if [ "$RUNNER_ARCH" = "arm64" ]; then export RUNNER_ARCH=aarch64 ; fi \
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x86_64 ; fi \
&& curl -f -L -o zig.tar.xz https://ziglang.org/download/${ZIG_VERSION}/zig-${TARGETOS}-${RUNNER_ARCH}-${ZIG_VERSION}.tar.xz \
&& tar xf zig.tar.xz \
&& rm zig.tar.xz \
&& mv zig-${TARGETOS}-${RUNNER_ARCH}-${ZIG_VERSION} zig-${ZIG_VERSION}

ENV PATH="/home/runner/zig-${ZIG_VERSION}:${PATH}"

# Install Node v20 and AWS CDK
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - \
&& sudo apt-get install -y nodejs \
&& sudo npm i -g aws-cdk

RUN sudo rm -rf /var/lib/apt/lists/*

0 comments on commit 2bfcda0

Please sign in to comment.