Skip to content

Commit

Permalink
Add ci/cd image builder (#172)
Browse files Browse the repository at this point in the history
* add ci/cd image builder

* disable cache

* try this

* don't compile from scratch

* fix missing curl

* clean up
  • Loading branch information
paulgb authored Oct 20, 2023
1 parent 18462f4 commit f0319cd
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build CI/CD base image

on:
# schedule:
# - cron: '15 11 * * *'
push:
branches: [ "main" ]
paths:
- ".github/workflows/runner.Dockerfile"
pull_request:
branches: [ "main" ]
paths:
- ".github/workflows/runner.Dockerfile"

env:
REGISTRY: ghcr.io
IMAGE_NAME: cicd-runner-base


jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
file: .github/workflows/runner.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
7 changes: 7 additions & 0 deletions .github/workflows/runner.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM rust:1.56-slim

# Alternative approach:
# RUN cargo install wasm-pack

RUN apt-get update && apt-get install curl -y
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

0 comments on commit f0319cd

Please sign in to comment.