Skip to content

Commit

Permalink
WIP on github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andrius committed Feb 19, 2024
1 parent 206c752 commit b05508b
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 252 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ on:
workflow_dispatch:
# schedule:
# - cron: '0 0 * * *' # runs every day at midnight
#
defaults:
run:
shell: bash -euo pipefail {0}

jobs:
build-and-push:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.repository }}-${{ github.workflow_ref }}-${{ matrix.alpine_version }}-build
cancel-in-progress: false
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
alpine_version:
- 2.7
- latest
- edge
- 3.1
- 3.2
- 3.3
Expand All @@ -32,8 +42,6 @@ jobs:
- 3.17
- 3.18
- 3.19
- latest
- edge

steps:
- name: Check out code
Expand All @@ -48,17 +56,15 @@ jobs:
- name: Build and Push Image
run: |
if [ -f "Dockerfile-${{ matrix.alpine_version }}" ]; then
DOCKERFILE=Dockerfile-${{ matrix.alpine_version }}
DOCKERFILE="Dockerfile-${{ matrix.alpine_version }}"
else
DOCKERFILE=Dockerfile
DOCKERFILE="Dockerfile"
fi
docker buildx build \
--push \
--pull \
--quiet \
--platform linux/amd64,linux/arm64 \
--tag andrius/alpine-ruby:${{ matrix.alpine_version }} \
--build-arg ALPINE_VERSION=${{ matrix.alpine_version }} \
--file $DOCKERFILE
--file $DOCKERFILE \
.
33 changes: 18 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ LABEL "org.opencontainers.image.authors"="Andrius Kairiukstis <[email protected]>"
LABEL "org.opencontainers.image.source"="https://github.com/andrius/alpine-ruby"
LABEL "org.opencontainers.image.description"="Minimal dockerized ruby based on alpine-linux"

ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1

ADD gemrc /root/.gemrc

RUN apk update && apk add \
RUN apk --no-cache add \
ca-certificates \
less \
libressl \
ruby \
ruby-etc \
ruby-bigdecimal \
ruby-etc \
ruby-io-console \
ruby-irb \
ca-certificates \
libressl \
less \
: \
&& apk add --virtual .build-dependencies build-base ruby-dev libressl-dev \
&& gem install bundler || apk add ruby-bundler \
ruby-irb

# The following is needed for nokogiri
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1

# It tries to install ruby bundler with failback to apk version and nokoiri
RUN apk add --no-cache --virtual .build-dependencies build-base ruby-dev libressl-dev \
&& ( gem install --no-rdoc --no-ri bundler || gem install --no-rdoc --no-ri bundler '~> 2.0' || apk add ruby-bundler ) \
&& gem install --no-rdoc --no-ri json \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle config git.allow_insecure true \
&& gem install json \
: \
&& gem cleanup \
&& apk del .build-dependencies \
&& rm -rf /usr/lib/ruby/gems/*/cache/* /var/cache/apk/* /tmp/* /var/tmp/*
&& rm -rf /usr/lib/ruby/gems/*/cache/* \
&& apk del .build-dependencies

COPY gemrc /root/.gemrc
35 changes: 0 additions & 35 deletions Dockerfile-2.7

This file was deleted.

33 changes: 0 additions & 33 deletions Dockerfile-3.10

This file was deleted.

32 changes: 0 additions & 32 deletions Dockerfile-3.5

This file was deleted.

32 changes: 0 additions & 32 deletions Dockerfile-3.6

This file was deleted.

32 changes: 0 additions & 32 deletions Dockerfile-3.7

This file was deleted.

33 changes: 0 additions & 33 deletions Dockerfile-3.8

This file was deleted.

32 changes: 0 additions & 32 deletions Dockerfile-3.9

This file was deleted.

0 comments on commit b05508b

Please sign in to comment.