Repository navigation
68 lines (59 loc) · 1.97 KB
/
Copy pathdocker.yml
File metadata and controls
68 lines (59 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Docker
on:
workflow_dispatch:
inputs:
image:
description: "Docker image name and tag"
required: false
default: "ret2shell:latest"
jobs:
# Build and export the docker image
build:
name: Build
runs-on: ubuntu-latest
env:
# These environment variables will be set by `setup-env.sh`
app_v: unknown
commit_sha: unknown
steps:
- uses: actions/checkout@v6
with:
# fetch depth 0 to fetch all history for git-restore-mtime-action
fetch-depth: 0
- uses: chetan/git-restore-mtime-action@v2
# Before this step, we can't use env variables declared in `env` of this job
- name: Setup environment
id: setup-env
run: bash .github/setup-env.sh
- name: Build on version ${{ env.app_v }}-${{ env.commit_sha }}
id: build
run: |
image="$(echo ${{ inputs.image }} | tr -d '[:space:]')"
if [ -z "$image" ]; then
image='ret2shell:${{ env.app_v }}'
fi
echo "image=$image" >> "$GITHUB_OUTPUT"
echo "Building: $image"
docker build \
--build-arg "R2S_GIT_VERSION=${{ env.commit_sha }}" \
--load \
-t "$image" \
-f Containerfile .
- name: Export image
id: export
run: |
image='${{ steps.build.outputs.image }}'
output_fn="$(echo "$image" | tr ':' '_')"
echo "output_fn=$output_fn" >> "$GITHUB_OUTPUT"
docker save "$image" -o '${{ runner.temp }}/image.tar'
sha256sum '${{ runner.temp }}/image.tar' > '${{ runner.temp }}/image.tar.sha256'
- name: Upload artifact
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: ${{ steps.export.outputs.output_fn }}
path: |
${{ runner.temp }}/image.tar
${{ runner.temp }}/image.tar.sha256
compression-level: 9
retention-days: 1