Skip to content

Commit fe6dd51

Browse files
committed
WIP on github workflows
1 parent 206c752 commit fe6dd51

23 files changed

+105
-704
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@ on:
55
workflow_dispatch:
66
# schedule:
77
# - cron: '0 0 * * *' # runs every day at midnight
8+
#
9+
defaults:
10+
run:
11+
shell: bash -euo pipefail {0}
812

913
jobs:
1014
build-and-push:
1115
runs-on: ubuntu-latest
16+
concurrency:
17+
group: ${{ github.repository }}-${{ github.workflow_ref }}-${{ matrix.alpine_version }}-build
18+
cancel-in-progress: false
19+
timeout-minutes: 60
1220
strategy:
21+
max-parallel: 64
22+
fail-fast: false
1323
matrix:
1424
alpine_version:
15-
- 2.7
16-
- 3.1
17-
- 3.2
18-
- 3.3
19-
- 3.4
20-
- 3.5
21-
- 3.6
22-
- 3.7
25+
- latest
26+
- edge
2327
- 3.8
2428
- 3.9
2529
- 3.10
@@ -32,8 +36,6 @@ jobs:
3236
- 3.17
3337
- 3.18
3438
- 3.19
35-
- latest
36-
- edge
3739

3840
steps:
3941
- name: Check out code
@@ -43,22 +45,36 @@ jobs:
4345
uses: docker/setup-buildx-action@v3
4446

4547
- name: Login to Docker Hub
46-
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
48+
run: docker login -u andrius -p ${{ secrets.DOCKERHUB_TOKEN }}
49+
50+
- name: Build and push image
51+
run: |
52+
if [ -f "Dockerfile-${{ matrix.alpine_version }}" ]; then
53+
DOCKERFILE="Dockerfile-${{ matrix.alpine_version }}"
54+
else
55+
DOCKERFILE="Dockerfile"
56+
fi
57+
58+
docker buildx build \
59+
--push \
60+
--platform linux/amd64,linux/arm64 \
61+
--tag andrius/alpine-ruby:${{ matrix.alpine_version }} \
62+
--build-arg ALPINE_VERSION=${{ matrix.alpine_version }} \
63+
--file $DOCKERFILE \
64+
.
4765
48-
- name: Build and Push Image
66+
- name: Build and push glibc image
4967
run: |
5068
if [ -f "Dockerfile-${{ matrix.alpine_version }}" ]; then
51-
DOCKERFILE=Dockerfile-${{ matrix.alpine_version }}
69+
DOCKERFILE="Dockerfile-glibc-${{ matrix.alpine_version }}"
5270
else
53-
DOCKERFILE=Dockerfile
71+
DOCKERFILE="Dockerfile-glibc"
5472
fi
5573
5674
docker buildx build \
5775
--push \
58-
--pull \
59-
--quiet \
6076
--platform linux/amd64,linux/arm64 \
6177
--tag andrius/alpine-ruby:${{ matrix.alpine_version }} \
6278
--build-arg ALPINE_VERSION=${{ matrix.alpine_version }} \
63-
--file $DOCKERFILE
79+
--file $DOCKERFILE \
6480
.

Dockerfile

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,39 @@ FROM alpine:${ALPINE_VERSION}
44

55
LABEL "org.opencontainers.image.authors"="Andrius Kairiukstis <[email protected]>"
66
LABEL "org.opencontainers.image.source"="https://github.com/andrius/alpine-ruby"
7-
LABEL "org.opencontainers.image.description"="Minimal dockerized ruby based on alpine-linux"
7+
LABEL "org.opencontainers.image.description"="Minimal dockerized ruby based on Alpine Linux"
88

9-
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1
9+
RUN apk --no-cache add bash
1010

11-
ADD gemrc /root/.gemrc
11+
SHELL ["/bin/bash", "-c"]
1212

13-
RUN apk update && apk add \
13+
RUN apk --no-cache add \
14+
ca-certificates \
15+
less \
16+
libressl \
1417
ruby \
15-
ruby-etc \
1618
ruby-bigdecimal \
19+
ruby-etc \
1720
ruby-io-console \
18-
ruby-irb \
19-
ca-certificates \
20-
libressl \
21-
less \
22-
: \
23-
&& apk add --virtual .build-dependencies build-base ruby-dev libressl-dev \
24-
&& gem install bundler || apk add ruby-bundler \
25-
&& bundle config build.nokogiri --use-system-libraries \
26-
&& bundle config git.allow_insecure true \
27-
&& gem install json \
28-
: \
29-
&& gem cleanup \
30-
&& apk del .build-dependencies \
31-
&& rm -rf /usr/lib/ruby/gems/*/cache/* /var/cache/apk/* /tmp/* /var/tmp/*
21+
ruby-irb
22+
23+
COPY gemrc /root/.gemrc
24+
25+
# The following is needed for nokogiri
26+
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1
27+
28+
# It tries to install ruby bundler with failback to apk version and nokoiri
29+
RUN <<EOF
30+
apk add --no-cache --virtual .build-dependencies build-base ruby-dev libressl-dev
31+
ERR=$(gem install bundler 2>&1);
32+
if [[ $ERR =~ \`(.+)\` ]]; then
33+
eval "${BASH_REMATCH[1]} 2>&1"
34+
fi || apk add ruby-bundler
35+
gem install json
36+
bundle config build.nokogiri --use-system-libraries
37+
bundle config git.allow_insecure true
38+
gem cleanup
39+
rm -rf /usr/lib/ruby/gems/*/cache/*
40+
apk del .build-dependencies
41+
EOF
42+

Dockerfile-2.7

Lines changed: 0 additions & 35 deletions
This file was deleted.

Dockerfile-3.1

Lines changed: 0 additions & 35 deletions
This file was deleted.

Dockerfile-3.10

Lines changed: 0 additions & 33 deletions
This file was deleted.

Dockerfile-3.11

Lines changed: 0 additions & 33 deletions
This file was deleted.

Dockerfile-3.12

Lines changed: 0 additions & 33 deletions
This file was deleted.

Dockerfile-3.13

Lines changed: 0 additions & 33 deletions
This file was deleted.

Dockerfile-3.2

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)