[AZ-204] OCI revision labels + AZAION_REVISION env

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-04-20 03:58:47 +03:00
parent 7790b4cf16
commit 0b4866bf29
2 changed files with 10 additions and 1 deletions
+8 -1
View File
@@ -13,7 +13,14 @@ steps:
from_secret: registry_host from_secret: registry_host
commands: commands:
- if [ "$CI_COMMIT_BRANCH" = "main" ]; then export TAG=arm; else export TAG=${CI_COMMIT_BRANCH}-arm; fi - if [ "$CI_COMMIT_BRANCH" = "main" ]; then export TAG=arm; else export TAG=${CI_COMMIT_BRANCH}-arm; fi
- docker build -f Dockerfile -t $REGISTRY_HOST/flights:$TAG . - export BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
- |
docker build -f Dockerfile \
--build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA \
--label org.opencontainers.image.revision=$CI_COMMIT_SHA \
--label org.opencontainers.image.created=$BUILD_DATE \
--label org.opencontainers.image.source=$CI_REPO_URL \
-t $REGISTRY_HOST/flights:$TAG .
- docker push $REGISTRY_HOST/flights:$TAG - docker push $REGISTRY_HOST/flights:$TAG
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
+2
View File
@@ -6,6 +6,8 @@ RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \
dotnet publish -c Release -o /app --os linux --arch $arch dotnet publish -c Release -o /app --os linux --arch $arch
FROM mcr.microsoft.com/dotnet/aspnet:10.0 FROM mcr.microsoft.com/dotnet/aspnet:10.0
ARG CI_COMMIT_SHA=unknown
ENV AZAION_REVISION=$CI_COMMIT_SHA
WORKDIR /app WORKDIR /app
COPY --from=build /app . COPY --from=build /app .
EXPOSE 8080 EXPOSE 8080