Skip to content

Commit e96b91e

Browse files
authored
Merge pull request #34 from DataDog/lloeki/add-mirror-images
Add service images
2 parents 11f768a + 2a85574 commit e96b91e

File tree

15 files changed

+291
-32
lines changed

15 files changed

+291
-32
lines changed

.github/workflows/build-services.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Build Services
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
push:
7+
description: Push images
8+
required: true
9+
type: boolean
10+
default: true
11+
workflow_call:
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
REPO: datadog/images-rb
16+
17+
jobs:
18+
build:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- service: datadog/agent
24+
arch: ["x86_64", "aarch64"]
25+
- service: datadog/dd-apm-test-agent
26+
arch: ["x86_64", "aarch64"]
27+
- service: elasticsearch
28+
arch: ["x86_64", "aarch64"]
29+
- service: memcached
30+
arch: ["x86_64", "aarch64"]
31+
- service: mongo
32+
arch: ["x86_64", "aarch64"]
33+
- service: mysql
34+
arch: ["x86_64", "aarch64"]
35+
- service: opensearchproject/opensearch
36+
arch: ["x86_64", "aarch64"]
37+
- service: postgres
38+
arch: ["x86_64", "aarch64"]
39+
- service: redis
40+
arch: ["x86_64", "aarch64"]
41+
- service: starburstdata/presto
42+
arch: ["x86_64", "aarch64"]
43+
runs-on: ubuntu-24.04
44+
permissions:
45+
packages: write
46+
name: Build (${{ matrix.service }})
47+
steps:
48+
- name: Set up Docker
49+
uses: crazy-max/ghaction-setup-docker@635d07c09dc2b52072362e9bb37e7e789767106d
50+
with:
51+
daemon-config: |
52+
{
53+
"features": {
54+
"containerd-snapshotter": true
55+
}
56+
}
57+
- name: Set up Ruby
58+
uses: ruby/setup-ruby@2654679fe7f7c29875c669398a8ec0791b8a64a1
59+
with:
60+
ruby-version: '3.4'
61+
- name: Checkout
62+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
63+
with:
64+
persist-credentials: false
65+
fetch-depth: 2
66+
- name: Bundle install
67+
run: |
68+
bundle install
69+
- name: Set variables
70+
id: vars
71+
run: |
72+
echo "DOCKER_PLATFORMS=$(echo ${{ join(matrix.arch) }} | tr ',' '\n' | sed 's/^/linux\//' | paste -s -d, -)" >> $GITHUB_OUTPUT
73+
74+
# First, build image for x86_64 as it will fail fast
75+
#
76+
- name: Build single-arch image (x86_64)
77+
if: ${{ contains(matrix.arch, 'x86_64') }}
78+
run: |
79+
bundle exec rake docker:build['services/${{ matrix.service }}:*'] PLATFORM='linux/x86_64'
80+
81+
# Then, build image for aarch64 which, being emulated under qemu, is slower
82+
#
83+
# Start by enabling qemu for aarch64
84+
- name: Enable aarch64 emulation (x86_64)
85+
if: ${{ contains(matrix.arch, 'aarch64') }}
86+
run: |
87+
docker run --privileged --rm tonistiigi/binfmt --install arm64
88+
- name: Build single-arch image (aarch64)
89+
if: ${{ contains(matrix.arch, 'aarch64') }}
90+
run: |
91+
bundle exec rake docker:build['services/${{ matrix.service }}:*'] PLATFORM='linux/aarch64'
92+
93+
# Finally, assemble multi-arch image for a combined push to the registry
94+
#
95+
# This reruns docker build but layers are in the cache, so it's fast
96+
- name: Log in to the Container Registry
97+
run: |
98+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
99+
- name: Push release image (${{ join(matrix.arch, ', ') }})
100+
if: ${{ inputs.push }}
101+
run: |
102+
bundle exec rake docker:build['services/${{ matrix.service }}:*'] PLATFORM='${{ steps.vars.outputs.DOCKER_PLATFORMS }}' PUSH=true

.github/workflows/main.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ on:
66
- "**"
77

88
jobs:
9-
build:
10-
name: Build
9+
build-services:
10+
name: Build Services
11+
uses: ./.github/workflows/build-services.yml
12+
permissions:
13+
packages: write
14+
15+
build-ruby:
16+
name: Build Ruby
1117
uses: ./.github/workflows/build-ruby.yml
1218
permissions:
1319
packages: write
@@ -22,7 +28,8 @@ jobs:
2228
success:
2329
name: Success
2430
needs:
25-
- build
31+
- build-services
32+
- build-ruby
2633
- nix
2734
runs-on: ubuntu-24.04
2835
steps:

README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Use cases include:
1010

1111
- having a consistent set of images to build other images from
1212
- providing base images for CI usage and testing as well as local development
13+
- providing service images for integration with testing suites
1314
- providing minimal app images using various frameworks for CI testing (integration, system tests), issue reproduction, support engineers, pentesters...
1415
- making CI runtime environment reproducinble locally
1516
- hastening image building and fetching by mutualising commonality
@@ -19,19 +20,22 @@ Use cases include:
1920

2021
### Ruby engines
2122

23+
Directory: `src/engines`
24+
2225
Supported engines include:
2326

2427
- `ruby`: MRI a.k.a CRuby.
2528
- `jruby`: These are based on Eclise Temurin JDK builds.
2629
- `truffleruby`: Due to the nature and state of TruffleRuby these are experimental and may or may not work as expected.
2730

28-
### Apps
31+
Tag naming acts as a contract and conveys intended usage:
32+
33+
- If you expect a compiler use `-gcc` or `-clang` tags; images withotu this do not guarantee presence of a compiler.
34+
- If you expect a certain libc (variant or version), use the appropriate `-musl`, -gnu` (glibc), or `-centos` (old glibc) tags.
35+
- "Naked" version tags give you that specific runtime, but assume no specific Linux distribution, libc version or variant, and no compiler.
2936

30-
#### minimal-rack
37+
### Services
3138

32-
These images provide a set of minimal rack-based applications covering a range of frameworks and versions:
39+
Directory: `src/services`
3340

34-
- `rack` 1.3 to 3 and up
35-
- `rails` 3.2 to 7 and up
36-
- `sinatra` 1.0 to 4 and up
37-
- `grape` 1.2 to 4 and up
41+
Service images are intended to provide known, fixed behaviour for test suites.

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# @type self: Rake::TaskLib
44

55
# load rake tasks from tasks directory
6-
if RUBY_VERSION.start_with?("1.8.")
6+
if RUBY_VERSION < "2.3."
77
import File.join(File.dirname(__FILE__) || Dir.pwd, "tasks", "test.rake")
88
else
99
Dir.glob(File.join(File.dirname(__FILE__) || Dir.pwd, "tasks", "**", "*.rake")) { |f| import f }

src/services/datadog/agent/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM datadog/agent
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.12.0
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM elasticsearch:8.1.3
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM memcached:1.5-alpine
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb

src/services/mongo/3.6/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM mongo:3.6
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb

src/services/mysql/8.0/Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM mysql:8.0
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
4+
5+
CMD ["--default-authentication-plugin=mysql_native_password"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM opensearchproject/opensearch:2.8.0
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb

src/services/postgres/9.6/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM postgres:9.6
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb

src/services/redis/6.2/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM redis:6.2
2+
3+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# append-tags: e.9
2+
FROM starburstdata/presto:332-e.9
3+
4+
LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb

0 commit comments

Comments
 (0)