Skip to content

Commit 6aa7abd

Browse files
Add container build
1 parent c144dfc commit 6aa7abd

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Docker
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
schedule:
10+
- cron: '16 18 * * *'
11+
push:
12+
branches: [main]
13+
# Publish semver tags as releases.
14+
tags: ['v*.*.*']
15+
pull_request:
16+
branches: [main]
17+
18+
env:
19+
# Use docker.io for Docker Hub if empty
20+
REGISTRY: ghcr.io
21+
# github.repository as <account>/<repo>
22+
IMAGE_NAME: ${{ github.GITHUB_REPOSITORY_OWNER }}/vulnerable-tomcat
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
# This is used to complete the identity challenge
31+
# with sigstore/fulcio when running outside of PRs.
32+
id-token: write
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v3
37+
38+
# Workaround: https://github.com/docker/build-push-action/issues/461
39+
- name: Setup Docker buildx
40+
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
41+
42+
# Login against a Docker registry except on PR
43+
# https://github.com/docker/login-action
44+
- name: Log into registry ${{ env.REGISTRY }}
45+
if: github.event_name != 'pull_request'
46+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
# Extract metadata (tags, labels) for Docker
53+
# https://github.com/docker/metadata-action
54+
- name: Extract Docker metadata
55+
id: meta
56+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
57+
with:
58+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
59+
60+
# Build and push Docker image with Buildx (don't push on PR)
61+
# https://github.com/docker/build-push-action
62+
- name: Build and push Docker image
63+
id: build-and-push
64+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
65+
with:
66+
context: vulnerable-tomcat/.
67+
push: ${{ github.event_name != 'pull_request' }}
68+
tags: ${{ steps.meta.outputs.tags }}
69+
labels: ${{ steps.meta.outputs.labels }}

vulnerable-tomcat/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
## Example (Docker)
66

7+
Prebuilt image availible at [Docker Hub](https://hub.docker.com/r/bobtheshoplifter/spring4shell-vulnerable-tomcat)
8+
79
An example of a vulnerable Tomcat application + server.
810

911
War files built from /spring-war folder. (It is recommended to build your own war files but i have provided one based on <https://spring.io/guides/gs/handling-form-submission/>)

0 commit comments

Comments
 (0)