Skip to content

Commit 206c752

Browse files
committed
Generic Dockerfile for the new alpine repos
1 parent 1762308 commit 206c752

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
# schedule:
7+
# - cron: '0 0 * * *' # runs every day at midnight
8+
9+
jobs:
10+
build-and-push:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
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
23+
- 3.8
24+
- 3.9
25+
- 3.10
26+
- 3.11
27+
- 3.12
28+
- 3.13
29+
- 3.14
30+
- 3.15
31+
- 3.16
32+
- 3.17
33+
- 3.18
34+
- 3.19
35+
- latest
36+
- edge
37+
38+
steps:
39+
- name: Check out code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Login to Docker Hub
46+
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Build and Push Image
49+
run: |
50+
if [ -f "Dockerfile-${{ matrix.alpine_version }}" ]; then
51+
DOCKERFILE=Dockerfile-${{ matrix.alpine_version }}
52+
else
53+
DOCKERFILE=Dockerfile
54+
fi
55+
56+
docker buildx build \
57+
--push \
58+
--pull \
59+
--quiet \
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+
.

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# vim:set fenc=utf-8 ts=2 sw=2 sts=2 et ft=dockerfile:
2+
ARG ALPINE_VERSION
3+
FROM alpine:${ALPINE_VERSION}
4+
5+
LABEL "org.opencontainers.image.authors"="Andrius Kairiukstis <[email protected]>"
6+
LABEL "org.opencontainers.image.source"="https://github.com/andrius/alpine-ruby"
7+
LABEL "org.opencontainers.image.description"="Minimal dockerized ruby based on alpine-linux"
8+
9+
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1
10+
11+
ADD gemrc /root/.gemrc
12+
13+
RUN apk update && apk add \
14+
ruby \
15+
ruby-etc \
16+
ruby-bigdecimal \
17+
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/*

0 commit comments

Comments
 (0)