-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use inline Docker container build workaround
- Loading branch information
Showing
6 changed files
with
74 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
ARG BASE_IMAGE | ||
|
||
FROM $BASE_IMAGE | ||
FROM alpine:latest | ||
|
||
COPY docker-action /docker-action | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN apk add --update --no-cache docker | ||
RUN ["chmod", "+x", "/entrypoint.sh"] | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ARG BASE_IMAGE | ||
|
||
FROM $BASE_IMAGE | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN ["chmod", "+x", "/entrypoint.sh"] | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash -l | ||
|
||
set -x | ||
|
||
echo $PWD | ||
ls -l | ||
|
||
exec "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
#!/bin/bash -l | ||
#!/bin/sh -l | ||
|
||
set -x | ||
set -ex | ||
|
||
echo $PWD | ||
ls -l | ||
BASE_IMAGE=$1 | ||
BUILD_SCRIPT=$2 | ||
NETWORK=$3 | ||
|
||
exec "$1" | ||
cd /docker-action | ||
|
||
echo "Creating Docker image from: $BASE_IMAGE" | ||
docker build -t docker-action --build-arg BASE_IMAGE="$BASE_IMAGE" . | ||
|
||
# Credit to https://github.com/zmingxie/packer-ami-builder for the following | ||
# logic to determine the workspace directory | ||
REPO_NAME=$(basename $RUNNER_WORKSPACE) | ||
WORKSPACE="$RUNNER_WORKSPACE/$REPO_NAME" | ||
|
||
echo "Using Docker network: $NETWORK" | ||
|
||
echo "Running build script: $BUILD_SCRIPT" | ||
docker run -t -v $WORKSPACE:$GITHUB_WORKSPACE \ | ||
--workdir $GITHUB_WORKSPACE \ | ||
--network $NETWORK \ | ||
docker-action "$BUILD_SCRIPT" |