Run deployment tests from Docker build context
This commit is contained in:
@@ -14,12 +14,13 @@ NODES="${NODES:-192.168.86.72 192.168.86.73 192.168.86.74}"
|
|||||||
BUILD_TAG="$(git rev-parse HEAD)"
|
BUILD_TAG="$(git rev-parse HEAD)"
|
||||||
API_IMAGE="step3-questions:${BUILD_TAG}"
|
API_IMAGE="step3-questions:${BUILD_TAG}"
|
||||||
WEB_IMAGE="step3-web:${BUILD_TAG}"
|
WEB_IMAGE="step3-web:${BUILD_TAG}"
|
||||||
|
TEST_IMAGE="step3-tests:${BUILD_TAG}"
|
||||||
API_TAR="/tmp/step3-questions-${DEPLOYMENT_ENVIRONMENT}.tar"
|
API_TAR="/tmp/step3-questions-${DEPLOYMENT_ENVIRONMENT}.tar"
|
||||||
WEB_TAR="/tmp/step3-web-${DEPLOYMENT_ENVIRONMENT}.tar"
|
WEB_TAR="/tmp/step3-web-${DEPLOYMENT_ENVIRONMENT}.tar"
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -f "${API_TAR}" "${WEB_TAR}"
|
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
|
docker image prune -f >/dev/null || true
|
||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
@@ -32,12 +33,7 @@ docker builder prune -af || true
|
|||||||
docker system df
|
docker system df
|
||||||
df -h
|
df -h
|
||||||
|
|
||||||
docker run --rm \
|
docker build -f api/QuestionsApi.Tests/Dockerfile -t "${TEST_IMAGE}" .
|
||||||
--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 --build-arg BUILD_REVISION="${BUILD_TAG}" -t "${API_IMAGE}" api/QuestionsApi
|
docker build --build-arg BUILD_REVISION="${BUILD_TAG}" -t "${API_IMAGE}" api/QuestionsApi
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg BUILD_REVISION="${BUILD_TAG}" \
|
--build-arg BUILD_REVISION="${BUILD_TAG}" \
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user