-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
140 additions
and
24 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,91 @@ | ||
name: publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
build-and-publish-amd64: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get tag name | ||
uses: olegtarasov/[email protected] | ||
id: tagName | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: kubetail/echoserver:${{ steps.tagName.outputs.tag }}-amd64 | ||
|
||
build-and-publish-arm64: | ||
runs-on: arm64-ubuntu-22 | ||
steps: | ||
- name: Get tag name | ||
uses: olegtarasov/[email protected] | ||
id: tagName | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: kubetail/echoserver:${{ steps.tagName.outputs.tag }}-arm64 | ||
|
||
create-and-publish-manifest: | ||
runs-on: ubuntu-latest | ||
needs: [build-and-publish-amd64, build-and-publish-arm64] | ||
steps: | ||
- name: Get tag name | ||
uses: olegtarasov/[email protected] | ||
id: tagName | ||
- name: 'Setup jq' | ||
uses: dcarbone/install-jq-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Create and push manifest | ||
run: | | ||
docker buildx imagetools create -t kubetail/echoserver:${{ steps.tagName.outputs.tag }} \ | ||
kubetail/echoserver:${{ steps.tagName.outputs.tag }}-amd64 \ | ||
kubetail/echoserver:${{ steps.tagName.outputs.tag }}-arm64 | ||
- name: Fetch docker token | ||
run: | | ||
TOKEN=$(curl -X POST "https://hub.docker.com/v2/users/login" -H "Content-Type: application/json" -d '{"username": "${{ secrets.DOCKERHUB_USERNAME }}", "password": "${{ secrets.DOCKERHUB_TOKEN }}"}' | jq -r '.token') | ||
echo "TOKEN=$TOKEN" >> $GITHUB_ENV | ||
- name: Delete extra arch manifests | ||
run: | | ||
declare -a archs=("amd64" "arm64") | ||
for arch in "${archs[@]}" | ||
do | ||
RESPONSE=$(curl -s -w "%{http_code}" \ | ||
-X DELETE \ | ||
-H "Authorization: Bearer $TOKEN" \ | ||
"https://hub.docker.com/v2/repositories/kubetail/echoserver/tags/${{ steps.tagName.outputs.tag }}-$arch") | ||
if [ "$RESPONSE" -ne 204 ]; then | ||
echo "DELETE for $arch failed with status $RESPONSE" | ||
exit 1 | ||
fi | ||
done |
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
# Echoserver | ||
|
||
This is a simple server that responds with the http headers it received. | ||
Image versions >= 1.4 removes the redirect introduced in 1.3. | ||
Image versions >= 1.3 redirect requests on :80 with `X-Forwarded-Proto: http` to :443. | ||
Image versions > 1.0 run an nginx server, and implement the echoserver using lua in the nginx config. | ||
Image versions <= 1.0 run a python http server instead of nginx, and don't redirect any requests. | ||
This is a fork of the enigmatic kubernetes echoserver | ||
|
||
## Build | ||
|
||
```console | ||
docker build -t echoserver:latest . | ||
docker run -it --rm -p 8080:8080 echoserver:latest | ||
``` |
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,19 @@ | ||
#!/bin/sh | ||
|
||
CERT_DIR=/certs | ||
CERT_FILE=$CERT_DIR/certificate.crt | ||
KEY_FILE=$CERT_DIR/privateKey.key | ||
|
||
# Check if certificate and key files exist, if not, create them | ||
if [ ! -f "$CERT_FILE" ] || [ ! -f "$KEY_FILE" ]; then | ||
#echo "Generating self-signed cert" | ||
#echo "Generating a 2048 bit RSA private key" | ||
mkdir -p $CERT_DIR | ||
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $KEY_FILE -out $CERT_FILE -subj "/C=US/ST=State/L=City/O=Organization/OU=OrgUnit/CN=localhost" -verbose | ||
#echo "writing new private key to '${KEY_FILE}'" | ||
fi | ||
|
||
# Start your application here, e.g., for a Node.js app | ||
# node /path/to/your/app.js | ||
echo "Starting nginx" | ||
exec "$@" |
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