Skip to content

Commit 7103a25

Browse files
coldfixtcardonne
authored andcommitted
Add a dockerhub build hook to build from different base images
1 parent 8cceba6 commit 7103a25

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
GitHub allows developers to run GitHub Actions workflows on your own runners.
77
This Docker image allows you to create your own runners on Docker.
88

9-
For now, there is only a Debian Buster image, but I may add more variants in the future. Feel free to create an issue if you want another base image.
9+
For now, there are only Debian Buster and Ubuntu Focal images, but I may add more variants in the future. Feel free to create an issue if you want another base image.
1010

1111
## Important notes
1212

docker/hooks/build

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /usr/bin/env bash
2+
set -ex
3+
4+
# This overrides Docker Hub's build command in order to specify the base image
5+
# as build argument. For more information on build hooks and environment
6+
# variables, see: https://docs.docker.com/docker-hub/builds/advanced/
7+
8+
TAG=${IMAGE_NAME##*:}
9+
if [[ $TAG == latest ]]; then
10+
TAG=debian-buster-slim
11+
fi
12+
13+
# Replace first '-' by ':'
14+
FROM=${TAG/-/:}
15+
16+
docker build . \
17+
--build-arg FROM=$FROM \
18+
-f ${DOCKERFILE_PATH:-Dockerfile} \
19+
-t $IMAGE_NAME

0 commit comments

Comments
 (0)