-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci, gha: Add Windows jobs based on Linux image
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: 'Run in Docker with environment' | ||
description: 'Run a command in a Docker container, while passing explicitly set environment variables into the container.' | ||
inputs: | ||
dockerfile: | ||
description: 'A Dockerfile that defines an image' | ||
required: true | ||
tag: | ||
description: 'A tag of an image' | ||
required: true | ||
command: | ||
description: 'A command to run in a container' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: docker/setup-buildx-action@v2 | ||
with: | ||
# See: https://github.com/moby/buildkit/issues/3969. | ||
driver-opts: | | ||
network=host | ||
- uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
tags: ${{ inputs.tag }} | ||
load: true | ||
cache-from: type=gha | ||
|
||
- # Tell Docker to pass environment variables in `env` into the container. | ||
run: > | ||
docker run \ | ||
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "--env \(.) "') \ | ||
--volume ${{ github.workspace }}:${{ github.workspace }} \ | ||
--workdir ${{ github.workspace }} \ | ||
${{ inputs.tag }} bash -c "${{ inputs.command }}" | ||
shell: bash |
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