Skip to content

Commit 5e7a671

Browse files
Switch from Travis CI to GitHub Actions
The matrix mechanism is slightly different, but we get 2000 CI minutes per month (instead of begging free CI minutes to Travis support every quarter…). This commit also is the first on the `main` branch, which will now be the default. This commit also: * fixes many issues with legacy Debian versions (`jessie` APT repository has been moved to archives, which broke many builds) * stops installing Yarn and Heroku CLI via APT, to avoid issues with their GPG keys that expire every few weeks * caps `rubygems` and `bundler` gems versions when Ruby < 2.6 (because latest `rubygems` and `bundler` versions require Ruby >= 2.6) by passing their version as Docker build arguments
1 parent 61874c2 commit 5e7a671

File tree

6 files changed

+167
-178
lines changed

6 files changed

+167
-178
lines changed

.github/workflows/docker-build.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
name: alpinelab/ruby-dev:${{ matrix.ruby }}${{ matrix.variant }}
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
ruby:
15+
- 3.1.3
16+
- 3.1.2
17+
- 3.1.1
18+
- 3.1.0
19+
- 3.0.5
20+
- 3.0.4
21+
- 3.0.3
22+
- 3.0.2
23+
- 3.0.1
24+
- 3.0.0
25+
- 2.7.7
26+
- 2.7.6
27+
- 2.7.5
28+
- 2.7.4
29+
- 2.7.3
30+
- 2.7.2
31+
- 2.7.1
32+
- 2.7.0
33+
- 2.6.9
34+
- 2.6.8
35+
- 2.6.7
36+
- 2.6.6
37+
- 2.6.5
38+
- 2.6.4
39+
- 2.6.3
40+
- 2.6.2
41+
- 2.6.1
42+
- 2.6.0
43+
- 2.5.9
44+
- 2.5.8
45+
- 2.5.7
46+
- 2.5.6
47+
- 2.5.5
48+
- 2.5.4
49+
- 2.5.3
50+
# Ruby 2.5.2 never existed: it was mis-packaged and 2.5.3 was released immediately to fix it
51+
- 2.5.1
52+
- 2.5.0
53+
- 2.4.10
54+
- 2.4.9
55+
- 2.4.8
56+
- 2.4.7
57+
- 2.4.6
58+
- 2.4.5
59+
- 2.4.4
60+
- 2.4.3
61+
- 2.4.2
62+
- 2.4.1
63+
- 2.4.0
64+
- 2.3.8
65+
- 2.3.7
66+
- 2.3.6
67+
- 2.3.5
68+
- 2.3.4
69+
- 2.3.3
70+
- 2.3.2
71+
- 2.3.1
72+
- 2.3.0
73+
variant: ["", "-alpine"]
74+
75+
exclude:
76+
# the following needs an explicit Alpine version, so we exlude them here and re-include them with explicit version below
77+
- { ruby: 2.4.3, variant: "-alpine" }
78+
- { ruby: 2.4.2, variant: "-alpine" }
79+
- { ruby: 2.4.1, variant: "-alpine"}
80+
# the following do not have an Alpine variant because Yarn is unavailable on their base Alpine version (< 3.6)
81+
- { ruby: 2.4.0, variant: "-alpine" }
82+
- { ruby: 2.3.6, variant: "-alpine" }
83+
- { ruby: 2.3.5, variant: "-alpine" }
84+
- { ruby: 2.3.4, variant: "-alpine" }
85+
- { ruby: 2.3.3, variant: "-alpine" }
86+
- { ruby: 2.3.2, variant: "-alpine" }
87+
- { ruby: 2.3.1, variant: "-alpine" }
88+
- { ruby: 2.3.0, variant: "-alpine" }
89+
90+
include:
91+
- ruby: 2.4.3
92+
variant: "-alpine3.7"
93+
- ruby: 2.4.2
94+
variant: "-alpine3.7"
95+
- ruby: 2.4.1
96+
variant: "-alpine3.6"
97+
steps:
98+
- uses: docker/setup-buildx-action@v2
99+
- uses: docker/login-action@v2
100+
with:
101+
username: ${{ secrets.DOCKERHUB_USERNAME }}
102+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
103+
- uses: docker/build-push-action@v2
104+
with:
105+
push: true
106+
build-args: |
107+
BASE_IMAGE_TAG=${{ matrix.ruby }}${{ matrix.variant }}
108+
109+
${{ startsWith(matrix.ruby, '2.5') && 'RUBYGEMS_VERSION_ARG=3.3.26' || '' }}
110+
${{ startsWith(matrix.ruby, '2.4') && 'RUBYGEMS_VERSION_ARG=3.3.26' || '' }}
111+
${{ startsWith(matrix.ruby, '2.3') && 'RUBYGEMS_VERSION_ARG=3.3.26' || '' }}
112+
113+
${{ startsWith(matrix.ruby, '2.5') && 'BUNDLER_VERSION_ARG=2.3.26' || '' }}
114+
${{ startsWith(matrix.ruby, '2.4') && 'BUNDLER_VERSION_ARG=2.3.26' || '' }}
115+
${{ startsWith(matrix.ruby, '2.3') && 'BUNDLER_VERSION_ARG=2.3.26' || '' }}
116+
117+
tags: |
118+
alpinelab/ruby-dev:${{ matrix.ruby }}${{ matrix.variant }}
119+
120+
${{ matrix.ruby == '3.1.3' && format('alpinelab/ruby-dev:latest{0}', matrix.variant) || '' }}
121+
${{ matrix.ruby == '3.1.3' && format('alpinelab/ruby-dev:3.1{0}', matrix.variant) || '' }}
122+
${{ matrix.ruby == '3.1.3' && format('alpinelab/ruby-dev:3{0}', matrix.variant) || '' }}
123+
${{ matrix.ruby == '2.7.7' && format('alpinelab/ruby-dev:2.7{0}', matrix.variant) || '' }}
124+
${{ matrix.ruby == '2.7.7' && format('alpinelab/ruby-dev:2{0}', matrix.variant) || '' }}
125+
${{ matrix.ruby == '2.6.9' && format('alpinelab/ruby-dev:2.6{0}', matrix.variant) || '' }}
126+
${{ matrix.ruby == '2.5.9' && format('alpinelab/ruby-dev:2.5{0}', matrix.variant) || '' }}
127+
${{ matrix.ruby == '2.4.10' && format('alpinelab/ruby-dev:2.4{0}', matrix.variant) || '' }}
128+
${{ matrix.ruby == '2.3.8' && format('alpinelab/ruby-dev:2.3{0}', matrix.variant) || '' }}
129+
130+
${{ (matrix.ruby == '2.4.3' && matrix.variant == '-alpine3.7') && 'alpinelab/ruby-dev:2.4.3-alpine' || '' }}
131+
${{ (matrix.ruby == '2.4.2' && matrix.variant == '-alpine3.7') && 'alpinelab/ruby-dev:2.4.2-alpine' || '' }}
132+
${{ (matrix.ruby == '2.4.3' && matrix.variant == '-alpine3.6') && 'alpinelab/ruby-dev:2.4.1-alpine' || '' }}
133+
134+
cache-from: type=gha
135+
cache-to: type=gha,mode=max

.travis.yml

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

Dockerfile

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ LABEL maintainer "Michael Baudino <[email protected]>"
1010
# as advised in https://github.com/docker-library/docs/blob/master/ruby/content.md#encoding
1111
ENV LANG="C.UTF-8"
1212

13+
ARG RUBYGEMS_VERSION_ARG="" \
14+
BUNDLER_VERSION_ARG=""
15+
1316
# Define dependencies base versions
14-
ENV RUBYGEMS_VERSION="3.4.5" \
15-
BUNDLER_VERSION="2.4.5" \
17+
ENV RUBYGEMS_VERSION=${RUBYGEMS_VERSION_ARG:-${RUBYGEMS_VERSION}} \
18+
BUNDLER_VERSION=${BUNDLER_VERSION_ARG} \
1619
NODE_VERSION="16" \
1720
GOSU_VERSION="1.16"
1821

@@ -57,24 +60,39 @@ RUN set -eux; \
5760
;; \
5861
\
5962
debian|ubuntu) \
60-
# Fix Jessie APT sources
61-
sed -i '/jessie-updates/d' /etc/apt/sources.list; \
63+
# Fix Jessie APT sources (it has been moved to http://archive.debian.org)
64+
sed -i \
65+
-e '/jessie[-\/]updates/d' \
66+
-e 's|http://deb.debian.org/debian jessie|http://archive.debian.org/debian jessie|' \
67+
/etc/apt/sources.list; \
6268
\
63-
# Install some prerequisites
69+
# Detect Debian version
6470
apt-get update; \
65-
apt-get install --assume-yes --no-install-recommends --no-install-suggests \
71+
apt-get install --assume-yes --no-install-recommends --no-install-suggests --force-yes \
6672
apt-transport-https \
6773
lsb-release \
6874
; \
6975
debianReleaseCodename=$(lsb_release -cs); \
7076
\
77+
# Old Debian releases specific configurations
78+
case ${debianReleaseCodename} in \
79+
jessie) \
80+
additionalAptFlags="--force-yes"; \
81+
additionalAptPackages="libssl1.0.0"; \
82+
;; \
83+
*) \
84+
additionalAptFlags=""; \
85+
additionalAptPackages=""; \
86+
;; \
87+
esac; \
88+
\
7189
# Fix LetsEncrypt expired CA on older Debian releases
7290
case ${debianReleaseCodename} in \
7391
jessie|buster|stretch) \
74-
apt-get install --assume-yes --no-install-recommends --no-install-suggests \
92+
apt-get install --assume-yes --no-install-recommends --no-install-suggests ${additionalAptFlags} \
7593
ca-certificates \
7694
curl \
77-
$([ "${debianReleaseCodename}" = "jessie" ] && echo libssl1.0.0) \
95+
${additionalAptPackages} \
7896
; \
7997
sed -i 's|mozilla/DST_Root_CA_X3.crt|!mozilla/DST_Root_CA_X3.crt|g' /etc/ca-certificates.conf; \
8098
update-ca-certificates; \
@@ -84,7 +102,7 @@ RUN set -eux; \
84102
# Add PostgreSQL APT repository
85103
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg; \
86104
case ${debianReleaseCodename} in \
87-
jessie) echo "deb https://apt-archive.postgresql.org/pub/repos/apt ${debianReleaseCodename}-pgdg-archive main" ;; \
105+
jessie|stretch) echo "deb https://apt-archive.postgresql.org/pub/repos/apt ${debianReleaseCodename}-pgdg-archive main" ;; \
88106
*) echo "deb https://apt.postgresql.org/pub/repos/apt/ ${debianReleaseCodename}-pgdg main" ;; \
89107
esac > /etc/apt/sources.list.d/pgdg.list; \
90108
\
@@ -97,7 +115,7 @@ RUN set -eux; \
97115
\
98116
# Install everything
99117
apt-get update; \
100-
apt-get install --assume-yes --no-install-recommends --no-install-suggests \
118+
apt-get install --assume-yes --no-install-recommends --no-install-suggests ${additionalAptFlags} \
101119
jq \
102120
nano \
103121
nodejs \
@@ -147,7 +165,7 @@ RUN set -eux; \
147165
# Install GEM dependencies
148166
# Note: we still need Bundler 1.x because Bundler auto-switches to it when it encounters a Gemfile.lock with BUNDLED WITH 1.x
149167
RUN gem update --system ${RUBYGEMS_VERSION} \
150-
&& gem install bundler:${BUNDLER_VERSION} \
168+
&& gem install bundler${BUNDLER_VERSION:+:${BUNDLER_VERSION}} \
151169
&& gem install bundler:1.17.3
152170

153171
# Add dot files to the home directory skeleton (they persist IRB/Pry/Rails console history, configure Yarn, etc…)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# `alpinelab/ruby-dev` [![Docker Stars](https://img.shields.io/docker/stars/alpinelab/ruby-dev.svg?style=flat-square)](https://hub.docker.com/r/alpinelab/ruby-dev/) [![Docker Pulls](https://img.shields.io/docker/pulls/alpinelab/ruby-dev.svg?style=flat-square)](https://hub.docker.com/r/alpinelab/ruby-dev/) [![Travis build](https://img.shields.io/travis/alpinelab/docker-ruby-dev.svg?style=flat-square)](https://app.travis-ci.com/alpinelab/docker-ruby-dev)
1+
# `alpinelab/ruby-dev` [![Docker Stars](https://img.shields.io/docker/stars/alpinelab/ruby-dev?style=flat-square)](https://hub.docker.com/r/alpinelab/ruby-dev/) [![Docker Pulls](https://img.shields.io/docker/pulls/alpinelab/ruby-dev.svg?style=flat-square)](https://hub.docker.com/r/alpinelab/ruby-dev/) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/alpinelab/docker-ruby-dev/docker-build.yml?style=flat-square)](https://github.com/alpinelab/docker-ruby-dev/actions/workflows/docker-build.yml)
22

33
The main goal of this project is to have a single Docker image to develop all your Ruby projects, with **all dependencies contained inside Docker** (like gems, NPM packages or even Ruby itself, that won't pollute your host environment) and without anything specific to the project in the Docker image (the **codebase is mounted directly from the host filesystem into the container**, thus you'll never have to build the image when you add a gem or change some code).
44

@@ -42,8 +42,8 @@ services:
4242
- config:/config
4343
```
4444
45-
> 💡 Feel free to use `alpinelab/ruby-dev:<ruby-version>`: we support [multiple Ruby versions](.travis.yml) [as Docker tags](https://hub.docker.com/r/alpinelab/ruby-dev/tags/)
46-
> and experimental Alpine Linux variants (append `-alpine` to image tag 🧪).
45+
> 💡 Feel free to use `alpinelab/ruby-dev:<ruby-version>`: we support [multiple Ruby versions](.github/workflows/docker-build.yml) [as Docker tags](https://hub.docker.com/r/alpinelab/ruby-dev/tags/)
46+
> and Alpine Linux variants (append `-alpine` to image tag).
4747

4848
<details>
4949

build.sh

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

0 commit comments

Comments
 (0)