Skip to content

better args passing #237

better args passing

better args passing #237

Workflow file for this run

name: primary
on: [push]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
container:
options: "--user 0"
#image: ubuntu:jammy-20220421
image: ghcr.io/unhookd/polly:3.0-rc1@sha256:7cc65086b101fe352a8ff83180888f0f7079b2f80139b0f39ba7b2a4cb34b168
steps:
- uses: actions/checkout@v3
- name: bootstrap
run: |
set -ex
(getent group alpha || groupadd --gid 121 alpha);
(getent group tau || groupadd --gid 123 tau);
(getent group beta || groupadd --gid 134 beta);
(getent group docker || groupadd --gid 999 docker);
(getent group theta || groupadd --gid 1000 theta);
(getent group zeta || groupadd --gid 1001 zeta);
(getent passwd app || useradd --uid 1000 --home-dir /home/app --create-home --shell /bin/bash app --groups alpha,beta,docker,theta,zeta,tau);
(getent passwd runner || useradd --uid 1001 --home-dir /home/runner --create-home --shell /bin/bash runner --groups alpha,beta,docker,theta,zeta,tau);
apt-get update; apt-get install -y locales locales-all; apt-get clean;
test -e /usr/lib/locale/locale-archive || ((locale-gen --purge en_US); (echo -e "LANG=$LANG\nLANGUAGE=$LANGUAGE\n" | tee /etc/default/locale); (locale-gen $LANGUAGE); (dpkg-reconfigure locales));
apt-get update; apt-get install -y vim git curl apt-transport-https aptitude ca-certificates apt-utils software-properties-common docker.io build-essential libyaml-dev ruby3* libruby3* ruby-bundler rubygems-integration rake amazon-ecr-credential-helper; apt-get clean;
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add;
apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main";
apt-get update; apt-get install -y kubectl; apt-get clean;
usermod -a -G $(grep docker /etc/group | cut -d: -f3) app;
usermod -a -G $(grep docker /etc/group | cut -d: -f3) runner;
mkdir -p /polly/safe/git /polly/safe/run /polly/safe/tmp /polly/app /app /__w/polly/polly;
chown -R app.alpha /home/app /polly /app /__w/polly/polly;
chown -R app /home/app /polly /app /__w/polly/polly;
chown -R app /home/app;
su app -s /bin/bash -c 'cd /__w/polly/polly && gem build polly.gemspec -o /home/app/polly-latest.gem';
gem install --no-document --minimal-deps /home/app/polly-latest.gem && grep -Rn '\.gem\.' /var/lib 2>/dev/null | cut -d: -f1 | sort | uniq | xargs -I{} rm {} && rm /home/app/polly-latest.gem;
su app -s /bin/bash -c 'cd /__w/polly/polly && polly generate > Dockerfile';
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}