Skip to content

Add service images #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/build-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build Services

on:
workflow_dispatch:
inputs:
push:
description: Push images
required: true
type: boolean
default: true
workflow_call:

env:
REGISTRY: ghcr.io
REPO: datadog/images-rb

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- service: datadog/agent
arch: ["x86_64", "aarch64"]
- service: datadog/dd-apm-test-agent
arch: ["x86_64", "aarch64"]
- service: elasticsearch
arch: ["x86_64", "aarch64"]
- service: memcached
arch: ["x86_64", "aarch64"]
- service: mongo
arch: ["x86_64", "aarch64"]
- service: mysql
arch: ["x86_64", "aarch64"]
- service: opensearchproject/opensearch
arch: ["x86_64", "aarch64"]
- service: postgres
arch: ["x86_64", "aarch64"]
- service: redis
arch: ["x86_64", "aarch64"]
- service: starburstdata/presto
arch: ["x86_64", "aarch64"]
runs-on: ubuntu-24.04
permissions:
packages: write
name: Build (${{ matrix.service }})
steps:
- name: Set up Docker
uses: crazy-max/ghaction-setup-docker@635d07c09dc2b52072362e9bb37e7e789767106d
with:
daemon-config: |
{
"features": {
"containerd-snapshotter": true
}
}
- name: Set up Ruby
uses: ruby/setup-ruby@2654679fe7f7c29875c669398a8ec0791b8a64a1
with:
ruby-version: '3.4'
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
persist-credentials: false
fetch-depth: 2
- name: Bundle install
run: |
bundle install
- name: Set variables
id: vars
run: |
echo "DOCKER_PLATFORMS=$(echo ${{ join(matrix.arch) }} | tr ',' '\n' | sed 's/^/linux\//' | paste -s -d, -)" >> $GITHUB_OUTPUT

# First, build image for x86_64 as it will fail fast
#
- name: Build single-arch image (x86_64)
if: ${{ contains(matrix.arch, 'x86_64') }}
run: |
bundle exec rake docker:build['services/${{ matrix.service }}:*'] PLATFORM='linux/x86_64'

# Then, build image for aarch64 which, being emulated under qemu, is slower
#
# Start by enabling qemu for aarch64
- name: Enable aarch64 emulation (x86_64)
if: ${{ contains(matrix.arch, 'aarch64') }}
run: |
docker run --privileged --rm tonistiigi/binfmt --install arm64
- name: Build single-arch image (aarch64)
if: ${{ contains(matrix.arch, 'aarch64') }}
run: |
bundle exec rake docker:build['services/${{ matrix.service }}:*'] PLATFORM='linux/aarch64'

# Finally, assemble multi-arch image for a combined push to the registry
#
# This reruns docker build but layers are in the cache, so it's fast
- name: Log in to the Container Registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
- name: Push release image (${{ join(matrix.arch, ', ') }})
if: ${{ inputs.push }}
run: |
bundle exec rake docker:build['services/${{ matrix.service }}:*'] PLATFORM='${{ steps.vars.outputs.DOCKER_PLATFORMS }}' PUSH=true
13 changes: 10 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ on:
- "**"

jobs:
build:
name: Build
build-services:
name: Build Services
uses: ./.github/workflows/build-services.yml
permissions:
packages: write

build-ruby:
name: Build Ruby
uses: ./.github/workflows/build-ruby.yml
permissions:
packages: write
Expand All @@ -22,7 +28,8 @@ jobs:
success:
name: Success
needs:
- build
- build-services
- build-ruby
- nix
runs-on: ubuntu-24.04
steps:
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Use cases include:

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

### Ruby engines

Directory: `src/engines`

Supported engines include:

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

### Apps
Tag naming acts as a contract and conveys intended usage:

- If you expect a compiler use `-gcc` or `-clang` tags; images withotu this do not guarantee presence of a compiler.
- If you expect a certain libc (variant or version), use the appropriate `-musl`, -gnu` (glibc), or `-centos` (old glibc) tags.
- "Naked" version tags give you that specific runtime, but assume no specific Linux distribution, libc version or variant, and no compiler.

#### minimal-rack
### Services

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

- `rack` 1.3 to 3 and up
- `rails` 3.2 to 7 and up
- `sinatra` 1.0 to 4 and up
- `grape` 1.2 to 4 and up
Service images are intended to provide known, fixed behaviour for test suites.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @type self: Rake::TaskLib

# load rake tasks from tasks directory
if RUBY_VERSION.start_with?("1.8.")
if RUBY_VERSION < "2.3."
import File.join(File.dirname(__FILE__) || Dir.pwd, "tasks", "test.rake")
else
Dir.glob(File.join(File.dirname(__FILE__) || Dir.pwd, "tasks", "**", "*.rake")) { |f| import f }
Expand Down
3 changes: 3 additions & 0 deletions src/services/datadog/agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM datadog/agent

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
3 changes: 3 additions & 0 deletions src/services/datadog/dd-apm-test-agent/v1.12.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.12.0

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
3 changes: 3 additions & 0 deletions src/services/elasticsearch/8.1.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM elasticsearch:8.1.3

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
3 changes: 3 additions & 0 deletions src/services/memcached/1.5/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM memcached:1.5-alpine

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
3 changes: 3 additions & 0 deletions src/services/mongo/3.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mongo:3.6

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
5 changes: 5 additions & 0 deletions src/services/mysql/8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mysql:8.0

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb

CMD ["--default-authentication-plugin=mysql_native_password"]
3 changes: 3 additions & 0 deletions src/services/opensearchproject/opensearch/2.8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM opensearchproject/opensearch:2.8.0

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
3 changes: 3 additions & 0 deletions src/services/postgres/9.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM postgres:9.6

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
3 changes: 3 additions & 0 deletions src/services/redis/6.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM redis:6.2

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
4 changes: 4 additions & 0 deletions src/services/starburstdata/presto/332/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# append-tags: e.9
FROM starburstdata/presto:332-e.9

LABEL org.opencontainers.image.source=https://github.com/DataDog/images-rb
Loading