Initial commit

This commit is contained in:
2024-07-02 13:09:46 +02:00
commit 11e0f786fe
15 changed files with 302 additions and 0 deletions

63
test/Makefile Normal file
View File

@ -0,0 +1,63 @@
# Simple makefile to test the action.
test: setup start run-test teardown
network:
@docker network create test_network
start-registry:
@echo "Starting docker registry"
@docker run -d \
-p 5000:5000 \
--name test-registry \
--network test_network \
-v ./htpasswd:/htpasswd \
-v ./cert:/cert \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/htpasswd \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/cert/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/cert/domain.key \
registry:2
build:
@echo "Building images..."
@docker build -t docker-private-registry-ssh-test:latest -q .
@docker build -t docker-private-registry-ssh-action:latest -q ..
start-client:
@echo "Starting ssh server"
@docker run -d -p 22140:22140 --name test-server --network test_network docker-private-registry-ssh-test:latest
cert:
openssl x509 -signkey cert/domain.key -in domain.csr -req -days 365 -out cert/domain.crt -extfile domain.ext
stop-registry:
@echo "Removing registry container"
@docker rm -f test-registry
stop-client:
@echo "Removing ssh server container"
@docker rm -f test-server
stop: stop-registry stop-client
start: start-registry start-client
clean: stop
@echo "Removing network"
@docker network rm test_network
setup: build network
teardown: stop clean
run-test:
@echo "Running test..."
@echo
@bash test.sh
.PHONY: start-registry stop-registry stop-client network clean cert start-client start teardown test all