Run deployment tests from Docker build context

This commit is contained in:
hz
2026-07-20 20:38:48 -05:00
parent 7829b10b23
commit c31242a500
2 changed files with 11 additions and 7 deletions
+3 -7
View File
@@ -14,12 +14,13 @@ NODES="${NODES:-192.168.86.72 192.168.86.73 192.168.86.74}"
BUILD_TAG="$(git rev-parse HEAD)"
API_IMAGE="step3-questions:${BUILD_TAG}"
WEB_IMAGE="step3-web:${BUILD_TAG}"
TEST_IMAGE="step3-tests:${BUILD_TAG}"
API_TAR="/tmp/step3-questions-${DEPLOYMENT_ENVIRONMENT}.tar"
WEB_TAR="/tmp/step3-web-${DEPLOYMENT_ENVIRONMENT}.tar"
cleanup() {
rm -f "${API_TAR}" "${WEB_TAR}"
docker image rm "${API_IMAGE}" "${WEB_IMAGE}" 2>/dev/null || true
docker image rm "${API_IMAGE}" "${WEB_IMAGE}" "${TEST_IMAGE}" 2>/dev/null || true
docker image prune -f >/dev/null || true
}
trap cleanup EXIT
@@ -32,12 +33,7 @@ docker builder prune -af || true
docker system df
df -h
docker run --rm \
--volume "${PWD}:/src" \
--workdir /src \
--env DOTNET_CLI_TELEMETRY_OPTOUT=1 \
mcr.microsoft.com/dotnet/sdk:8.0 \
dotnet test api/QuestionsApi.Tests/QuestionsApi.Tests.csproj -c Release
docker build -f api/QuestionsApi.Tests/Dockerfile -t "${TEST_IMAGE}" .
docker build --build-arg BUILD_REVISION="${BUILD_TAG}" -t "${API_IMAGE}" api/QuestionsApi
docker build \
--build-arg BUILD_REVISION="${BUILD_TAG}" \
+8
View File
@@ -0,0 +1,8 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
WORKDIR /src
COPY api/ ./api/
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
RUN dotnet test api/QuestionsApi.Tests/QuestionsApi.Tests.csproj -c Release