Skip to content

improve readme a bit (#25) #60

improve readme a bit (#25)

improve readme a bit (#25) #60

name: build-rails-base
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- ruby: '3.1.4'
folder: '3.1.x' # slim buster
tag: '3.1.4-slim@sha256:84ad66a846887df972a2143b8b8e8f737404fd7ad2373b5bb284ceae788f27d9'
- ruby: '3.2.1'
folder: '3.1.x' # slim buster
tag: '3.2.1-slim@sha256:287d618c44bc8d1fbf9b622021bc2680bf6610defa6dd709911dbcb764d9aefc'
- ruby: '3.2.2'
folder: '3.1.x' # slim bullseye
tag: '3.2.2-slim@sha256:81743b016046dd7e6fe55b3b408ac37735786c9dff409ca2191daffa0a66fa7e'
- ruby: '3.2.3'
folder: '3.1.x' # slim bookworm
tag: '3.2.3-slim@sha256:7bd0053d5820b233c060775c8fe21d25a9f3ee1ae4fb04bc8fe7887f9c44a2f3'
- ruby: '3.2.4'
folder: '3.1.x' # slim bookworm for linux/amd64
tag: '3.2.4-slim@sha256:3752526bb16284b5c8d5e45f2f83bae175e92cace720859d9e04700530392aa2'
container:
image: docker:git
env:
DOCKER_REPOSITORY: public.ecr.aws/degica/rails-base
DOCKER_BUILDKIT: '1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
runs-on: ubuntu-latest
steps:
- name: prepare
run: |-
apk add --no-cache python3 py3-pip
pip3 install --break-system-packages --upgrade pip
pip3 install --break-system-packages awscli
- name: workaround git security
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v3
- name: setup
run: git submodule update --init
- name: build_and_push
run: |-
cd rails-base/${{ matrix.folder }}
if [[ ${GITHUB_REF##*/} == 'master' ]]; then
IMAGE_TAG=${{ matrix.ruby }}
else
IMAGE_TAG=test-${GITHUB_REF##*/}-${{ matrix.ruby }} # branch name for dev usecases
fi
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/degica
docker build . -t $DOCKER_REPOSITORY:$IMAGE_TAG --build-arg RUBY_TAG=${{ matrix.tag }} --pull
docker images
docker push $DOCKER_REPOSITORY:$IMAGE_TAG
docker tag $DOCKER_REPOSITORY:$IMAGE_TAG $DOCKER_REPOSITORY:latest
docker push $DOCKER_REPOSITORY:latest
'on':
push:
branches:
- '*'