Skip to content

Commit

Permalink
Refactor: Update CI files
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Feb 25, 2024
1 parent 1a92f94 commit 64552ed
Show file tree
Hide file tree
Showing 39 changed files with 2,313 additions and 7 deletions.
1,778 changes: 1,778 additions & 0 deletions .github/workflows/ci-master-pr.yml

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: cron
on:
schedule:
# Run daily
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update-versions:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Admin user must generate a Personal Access Token with 'workflow' permissions, and used to populate the secret named WORKFLOW_TOKEN.
# See: https://stackoverflow.com/questions/68811838/refusing-to-allow-a-personal-access-token-to-create-or-update-workflow
# See: https://stackoverflow.com/questions/66643917/refusing-to-allow-a-github-app-to-create-or-update-workflow
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.WORKFLOW_TOKEN }} # This configures the git repo to use this token
fetch-depth: 0 # Fetch all branches and tags
- shell: pwsh
run: |
./Update-Versions.ps1 -PR -AutoMergeQueue -AutoRelease
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
66 changes: 59 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,65 @@
# Generate-DockerImageVariantsTemplates

Templates for [Generate-DockerImageVariants](https://github.com/theohbrothers/Generate-DockerImageVariants) repositories.
[![github-actions](https://github.com/theohbrothers/Generate-DockerImageVariantsTemplates/workflows/ci-master-pr/badge.svg)](https://github.com/theohbrothers/Generate-DockerImageVariantsTemplates/actions)
[![github-release](https://img.shields.io/github/v/release/theohbrothers/Generate-DockerImageVariantsTemplates?style=flat-square)](https://github.com/theohbrothers/Generate-DockerImageVariantsTemplates/releases/)
[![docker-image-size](https://img.shields.io/docker/image-size/theohbrothers/Generate-DockerImageVariantsTemplates/latest)](https://hub.docker.com/r/theohbrothers/Generate-DockerImageVariantsTemplates)

## Usage
Dockerized [webize](https://github.com/theohbrothers/webize) with useful tools.

```sh
# Vendor all files into current working directory
./vendor.sh --dry-run
## Tags

# Vendor CI files into current working directory
./vendor.sh ci --dry-run
| Tag | Dockerfile Build Context |
|:-------:|:---------:|
| `:0.8.0`, `:latest` | [View](variants/0.8.0) |
| `:0.8.0-curl` | [View](variants/0.8.0-curl) |
| `:0.7.1` | [View](variants/0.7.1) |
| `:0.7.1-curl` | [View](variants/0.7.1-curl) |
| `:0.6.1` | [View](variants/0.6.1) |
| `:0.6.1-curl` | [View](variants/0.6.1-curl) |
| `:0.5.1` | [View](variants/0.5.1) |
| `:0.5.1-curl` | [View](variants/0.5.1-curl) |
| `:0.4.0` | [View](variants/0.4.0) |
| `:0.4.0-curl` | [View](variants/0.4.0-curl) |
| `:0.3.1` | [View](variants/0.3.1) |
| `:0.3.1-curl` | [View](variants/0.3.1-curl) |
| `:0.2.2` | [View](variants/0.2.2) |
| `:0.2.2-curl` | [View](variants/0.2.2-curl) |
| `:0.1.0` | [View](variants/0.1.0) |
| `:0.1.0-curl` | [View](variants/0.1.0-curl) |
| `:0.0.3` | [View](variants/0.0.3) |
| `:0.0.3-curl` | [View](variants/0.0.3-curl) |

All variants are based on `alpine`.

## Development

Requires Windows `powershell` or [`pwsh`](https://github.com/PowerShell/PowerShell).

```powershell
# Install Generate-DockerImageVariants module: https://github.com/theohbrothers/Generate-DockerImageVariants
Install-Module -Name Generate-DockerImageVariants -Repository PSGallery -Scope CurrentUser -Force -Verbose
# Edit ./generate templates
# Generate the variants
Generate-DockerImageVariants .
```

### Variant versions

[versions.json](generate/definitions/versions.json) contains a list of [Semver](https://semver.org/) versions, one per line.

To update versions in `versions.json`:

```powershell
./Update-Versions.ps1
```

To update versions in `versions.json`, and open a PR for each changed version, and merge successful PRs one after another (to prevent merge conflicts), and finally create a tagged release and close milestone:

```powershell
$env:GITHUB_TOKEN = 'xxx'
./Update-Versions.ps1 -PR -AutoMergeQueue -AutoRelease
```

To perform a dry run, use `-WhatIf`.
16 changes: 16 additions & 0 deletions variants/0.0.3-curl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

RUN apk add --no-cache curl

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.0.3-curl/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
14 changes: 14 additions & 0 deletions variants/0.0.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.0.3/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
16 changes: 16 additions & 0 deletions variants/0.1.0-curl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

RUN apk add --no-cache curl

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.1.0-curl/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
14 changes: 14 additions & 0 deletions variants/0.1.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.1.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
16 changes: 16 additions & 0 deletions variants/0.2.2-curl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

RUN apk add --no-cache curl

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.2.2-curl/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
14 changes: 14 additions & 0 deletions variants/0.2.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.2.2/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
16 changes: 16 additions & 0 deletions variants/0.3.1-curl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

RUN apk add --no-cache curl

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.3.1-curl/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
14 changes: 14 additions & 0 deletions variants/0.3.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.3.1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
16 changes: 16 additions & 0 deletions variants/0.4.0-curl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

RUN apk add --no-cache curl

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.4.0-curl/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
14 changes: 14 additions & 0 deletions variants/0.4.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3.15
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN set -eux; \
wget -q https://raw.githubusercontent.com/theohbrothers/webize/master/webize -O /usr/local/bin/webize; \
chmod +x /usr/local/bin/webize

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "webize", "--help" ]
10 changes: 10 additions & 0 deletions variants/0.4.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- webize "$@"
elif [ $# -gt 0 ] && webize "$1" --help > /dev/null 2>&1; then
set -- webize "$@"
fi

exec "$@"
Loading

0 comments on commit 64552ed

Please sign in to comment.