11 Commits

Author SHA1 Message Date
529abe67b1 break Gitea actions up into separate files
All checks were successful
Ruby Lint / lint (push) Successful in 25s
Ruby Test / test (push) Successful in 32s
Release / docker (push) Successful in 4m3s
2025-05-06 00:58:37 -05:00
2bef46ea1b use Docker cache mount for apk
All checks were successful
Gitea Actions Demo / lint (push) Successful in 25s
Gitea Actions Demo / test (push) Successful in 13s
Gitea Actions Demo / docker (push) Successful in 3m23s
2025-05-05 22:51:18 -05:00
19d1e60d2f use Docker cache mount for Ruby bundler 2025-05-05 22:47:24 -05:00
2da770623f use Docker cache mount for Ruby gems 2025-05-05 22:46:42 -05:00
e90966970a move main ENV section in Dockerfiles 2025-05-05 22:45:52 -05:00
a54a46b0a6 use Docker cache mount for apt 2025-05-05 22:18:04 -05:00
a719e5f820 add Docker DX 2025-05-05 22:06:27 -05:00
3c4f656ec8 add Docker ARG for DEBIAN_VERSION 2025-05-02 15:37:41 -05:00
e0e6bf2507 add Docker ARG for BASE_REGISTRY 2025-05-02 15:32:26 -05:00
84908c0a24 set Debian frontend to noninteractive 2025-05-02 15:28:56 -05:00
762169f563 enable Ruby's YJIT 2025-05-02 15:27:33 -05:00
6 changed files with 107 additions and 94 deletions

View File

@ -6,7 +6,7 @@
"vscode": { "vscode": {
"extensions": [ "extensions": [
"Shopify.ruby-lsp", "Shopify.ruby-lsp",
"ms-azuretools.vscode-docker" "docker.docker"
] ]
} }
}, },

View File

@ -0,0 +1,23 @@
---
name: Ruby Lint
on:
push:
branches:
- "**"
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Ruby Setup
uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0
with:
ruby-version: '3.4'
bundler-cache: true
- name: Standard Ruby
run: bundle exec standardrb

View File

@ -1,65 +1,16 @@
--- ---
name: Gitea Actions Demo name: Release
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: on:
schedule: schedule:
- cron: "0 10 * * *" - cron: "0 0 * * *"
push: push:
branches: branches:
- "**" - main
tags: tags:
- "v*.*.*" - "v*.*.*"
pull_request:
jobs: jobs:
lint:
runs-on: ubuntu-latest
permissions:
checks: write
contents: write
steps:
- name: Login to Docker
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Ruby Setup
uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0
with:
ruby-version: '3.4'
bundler-cache: true
- run: bundle install
- name: Standard Ruby
run: bundle exec standardrb
test:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Test
uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0
with:
ruby-version: '3.4'
bundler-cache: true
- run: bundle exec rake
docker: docker:
needs: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
env: env:
DOCKER_ORG: ryanc DOCKER_ORG: ryanc
DOCKER_LATEST: latest DOCKER_LATEST: latest
@ -108,7 +59,8 @@ jobs:
latest=auto latest=auto
bake-target: docker-metadata-action bake-target: docker-metadata-action
tags: | tags: |
type=schedule type=schedule,pattern=nightly
type=edge
type=ref,event=branch type=ref,event=branch
type=ref,event=pr type=ref,event=pr
type=semver,pattern={{version}} type=semver,pattern={{version}}
@ -127,7 +79,8 @@ jobs:
latest=auto latest=auto
suffix=-alpine,onlatest=true suffix=-alpine,onlatest=true
tags: | tags: |
type=schedule type=schedule,pattern=nightly
type=edge
type=ref,event=branch type=ref,event=branch
type=ref,event=pr type=ref,event=pr
type=semver,pattern={{version}} type=semver,pattern={{version}}

View File

@ -0,0 +1,22 @@
---
name: Ruby Test
on:
push:
branches:
- "**"
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Test
uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0
with:
ruby-version: '3.4'
bundler-cache: true
- run: bundle exec rake

View File

@ -1,34 +1,38 @@
ARG RUBY_VERSION="3.4.3" ARG RUBY_VERSION="3.4.3"
FROM docker.io/library/ruby:${RUBY_VERSION}-alpine AS base ARG BASE_REGISTRY="docker.io"
FROM ${BASE_REGISTRY}/ruby:${RUBY_VERSION}-alpine AS base
WORKDIR /kubernaut
RUN <<EOT
apk update -q
apk add bash jemalloc
rm -rf /var/cache/apk
gem update --system --no-document
gem install -N bundler
EOT
ENV RACK_ENV="production" \ ENV RACK_ENV="production" \
BUNDLE_DEPLOYMENT=true \ BUNDLE_DEPLOYMENT=true \
BUNDLE_PATH="/usr/local/bundle" \ BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development test" BUNDLE_WITHOUT="development test" \
RUBY_YJIT_ENABLE=true
WORKDIR /kubernaut
RUN \
--mount=type=cache,id=var-cache-apk,target=/var/cache/apk,sharing=locked \
apk update -q; \
apk add bash jemalloc
RUN \
--mount=type=cache,id=usr-local-bundle-cache,target=${BUNDLE_PATH},sharing=locked \
gem update --system --no-document; \
gem install -N bundler
FROM base AS build FROM base AS build
RUN <<EOT RUN \
apk add musl-dev gcc make --mount=type=cache,id=var-cache-apk,target=/var/cache/apk,sharing=locked \
rm -rf /var/cache/apk apk update -q; \
EOT apk add musl-dev gcc make; \
apk add bash jemalloc
COPY Gemfile Gemfile.lock ./ COPY Gemfile Gemfile.lock ./
RUN <<EOT RUN \
--mount=type=cache,id=usr-local-bundle-ruby-cache,target=${BUNDLE_PATH}/ruby/3.4.0/cache,sharing=locked \
bundle install bundle install
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
EOT
COPY . . COPY . .

View File

@ -1,35 +1,46 @@
ARG RUBY_VERSION="3.4.3" ARG RUBY_VERSION="3.4.3"
FROM docker.io/library/ruby:${RUBY_VERSION}-slim-bookworm AS base ARG BASE_REGISTRY="docker.io"
ARG DEBIAN_VERSION="bookworm"
WORKDIR /kubernaut FROM ${BASE_REGISTRY}/ruby:${RUBY_VERSION}-slim-${DEBIAN_VERSION} AS base
RUN <<EOT
apt-get update -qq
apt-get install --yes --no-install-recommends libjemalloc2
rm -rf /var/lib/apt/lists /var/cache/apt/archives
gem update --system --no-document
gem install -N bundler
EOT
ENV RACK_ENV="production" \ ENV RACK_ENV="production" \
BUNDLE_DEPLOYMENT=true \ BUNDLE_DEPLOYMENT=true \
BUNDLE_PATH="/usr/local/bundle" \ BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development test" BUNDLE_WITHOUT="development test" \
RUBY_YJIT_ENABLE=true
WORKDIR /kubernaut
RUN rm -f /etc/apt/apt.conf.d/docker-clean
RUN \
--mount=type=cache,id=var-cache-apt,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=var-lib-apt,target=/var/lib/apt,sharing=locked \
apt-get update -qq; \
apt-get install --yes --no-install-recommends \
libjemalloc2
RUN \
--mount=type=cache,id=usr-local-bundle-cache,target=${BUNDLE_PATH},sharing=locked \
gem update --system --no-document; \
gem install -N bundler
ENV DEBIAN_FRONTEND="noninteractive"
FROM base AS build FROM base AS build
RUN <<EOT RUN \
apt-get update -qq --mount=type=cache,id=var-cache-apt,target=/var/cache/apt,sharing=locked \
apt-get install --yes --no-install-recommends gcc make libc-dev --mount=type=cache,id=var-lib-apt,target=/var/lib/apt,sharing=locked \
rm -rf /var/lib/apt/lists /var/cache/apt/archives apt-get update -qq; \
EOT apt-get install --yes --no-install-recommends \
build-essential
COPY Gemfile Gemfile.lock ./ COPY Gemfile Gemfile.lock ./
RUN <<EOT RUN \
--mount=type=cache,id=usr-local-bundle-ruby-cache,target=${BUNDLE_PATH}/ruby/3.4.0/cache,sharing=locked \
bundle install bundle install
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
EOT
COPY . . COPY . .