Skip to content

Commit

Permalink
Added demo
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Nov 15, 2023
1 parent 2e64519 commit 46349e0
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build-go

on:
push:
paths:
- "go/*.go"
- "go/go.mod"
- "go/go.sum"
- ".github/workflows/build-go.yml"
pull_request:
types:
- opened
- synchronize
- labeled
- reopened
paths:
- "go/*.go"
- "go/go.mod"
- "go/go.sum"
- ".github/workflows/build-go.yml"
workflow_dispatch:

permissions:
contents: read

jobs:

build-go:
name: build-go
runs-on: ubuntu-22.04
steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Build binary
run: |
cd go
go build -o ../hello .
- name: Smoke test
run: |
./hello
39 changes: 39 additions & 0 deletions .github/workflows/check-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: check-python

on:
push:
paths:
- "requirements.txt"
- ".github/workflows/check-python.yml"
pull_request:
types:
- opened
- synchronize
- labeled
- reopened
paths:
- "requirements.txt"
- ".github/workflows/check-python.yml"
workflow_dispatch:

permissions:
contents: read

jobs:

check-python:
name: check-python
runs-on: ubuntu-22.04
steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Install
run: |
pip install --requirement requirements.txt
- name: Smoke test
run: |
cowsay --help
pyfiglet --help
56 changes: 56 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: docker-build

on:
push:
branches-ignore:
- "renovate/**"
paths:
- "ubuntu/22.04/**"
- ".github/workflows/docker-build.yml"
pull_request:
types:
- opened
- synchronize
- labeled
- reopened
paths:
- "ubuntu/22.04/**"
- ".github/workflows/docker-build.yml"
workflow_dispatch:

jobs:
build:
name: docker-build
permissions:
packages: write
runs-on: ubuntu-latest
env:
IMAGE_TAG: 22.04
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
uses: docker/build-push-action@v4
with:
context: ubuntu/22.04
platforms: linux/amd64
provenance: false
sbom: false
cache-from: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
5 changes: 5 additions & 0 deletions go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/nicholasdille/clc23-renovate-demo

go 1.20

require github.com/TwiN/go-color v1.4.0
2 changes: 2 additions & 0 deletions go/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/TwiN/go-color v1.4.0 h1:fNbOwOrvup5oj934UragnW0B1WKaAkkB85q19Y7h4ng=
github.com/TwiN/go-color v1.4.0/go.mod h1:0QTVEPlu+AoCyTrho7bXbVkrCkVpdQr7YF7PYWEtSxM=
15 changes: 15 additions & 0 deletions go/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
"fmt"

"github.com/TwiN/go-color"
)

var Author string = "unknown"
var Version string = "none"

func main() {
println(color.InGreen("hello world"))
fmt.Printf("by %s, version %s", Author, Version)
}
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cowsay==5.0
pyfiglet==1.0.1
24 changes: 24 additions & 0 deletions ubuntu/22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#syntax=docker/dockerfile:1.6.0

FROM ubuntu:22.04 AS base

SHELL [ "bash", "-o", "errexit", "-c"]
ARG DEBIAN_FRONTEND=noninteractive

COPY <<no-recommends <<no-suggests /etc/apt/apt.conf.d/
APT::Install-Recommends "false";
no-recommends
APT::Install-Suggests "false";
no-suggests

RUN <<EOF
grep security /etc/apt/sources.list >/etc/apt/sources.list.d/security.list
apt-get update -o Dir::Etc::SourceList=/etc/apt/false -o Dir::Etc::SourceParts=/etc/apt/sources.list.d
apt-get upgrade -y
rm -f /etc/apt/sources.list.d/security.list
EOF

ARG ref=main
LABEL org.opencontainers.image.source="https://github.com/nicholasdille/clc23-renovate-demo" \
org.opencontainers.image.title="Ubuntu" \
org.opencontainers.image.description="Base image for Ubuntu"

0 comments on commit 46349e0

Please sign in to comment.