Skip to content

Commit

Permalink
Per #1546, changed build docker script to use Dockerfile.copy to use …
Browse files Browse the repository at this point in the history
…local source code, set environment variables that set docker build args in workflow yml
  • Loading branch information
georgemccabe committed Jan 20, 2022
1 parent f2dbb7d commit 3c55389
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
21 changes: 7 additions & 14 deletions .github/jobs/build_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@

source ${GITHUB_WORKSPACE}/.github/jobs/bash_functions.sh

local duration=$(( SECONDS - start_seconds ))
echo "TIMING: Command took `printf '%02d' $(($duration / 60))`:`printf '%02d' $(($duration % 60))` (MM:SS): '$*'"
if [ ${error} -ne 0 ]; then
echo "ERROR: '$*' exited with status = ${error}"
fi
return $error
}
#prefix=refs/heads/
#branch_name=${GITHUB_REF#"$prefix"}
DOCKERHUB_TAG=dtcenter/met:${SOURCE_BRANCH}

prefix=refs/heads/
branch_name=${GITHUB_REF#"$prefix"}
DOCKERHUB_TAG=dtcenter/met:${branch_name}

DOCKERFILE_DIR=${GITHUB_WORKSPACE}/scripts/docker
DOCKERFILE_PATH=${GITHUB_WORKSPACE}/scripts/docker/Dockerfile.copy

time_command docker build -t ${DOCKERHUB_TAG} \
--build-arg SOURCE_BRANCH=$branch_name \
$DOCKERFILE_DIR
--build-arg SOURCE_BRANCH \
--build-arg MET_BASE_IMAGE \
-f $DOCKERFILE_PATH ${GITHUB_WORKSPACE}
3 changes: 3 additions & 0 deletions .github/workflows/build_docker_and_trigger_metplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:

- name: Build Docker Image
run: .github/jobs/build_docker_image.sh
env:
SOURCE_BRANCH: ${GITHUB_REF#"refs/heads/"}
MET_BASE_IMAGE: minimum

- name: Push Docker Image
run: .github/jobs/push_docker_image.sh
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/test_compilation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Compilation Test

on:
push:
branches:
- feature_1546_ci_testing
paths-ignore:
- 'met/docs/**'

jobs:

build_met_docker:
name: Handle Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build Docker Image
run: .github/jobs/build_docker_image.sh
env:
SOURCE_BRANCH: ${GITHUB_REF#"refs/heads/"}
MET_BASE_IMAGE: minimum

0 comments on commit 3c55389

Please sign in to comment.