diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 076485b..52fa10f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ build: - if: $CI_COMMIT_BRANCH tags: [ docker ] before_script: - - echo "COMMIT=`git rev-parse HEAD`" >> version.env + - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env # COMMIT=`git rev-parse HEAD` script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF} @@ -25,6 +25,7 @@ deploy: rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH before_script: + - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env - source version.env - Building docker image for commit "${COMMIT}" with version "${VERSION}" script: diff --git a/Dockerfile b/Dockerfile index 9b5a9f3..5819ef5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN apk update \ && apk del build-deps COPY app /app -COPY version.env /app/version.env +COPY version.env /version.env COPY README.md /README.md HEALTHCHECK --start-period=30s --interval=10s --timeout=5s --retries=3 CMD curl --insecure --fail https://localhost/status || exit 1 diff --git a/app/main.py b/app/main.py index b48ffab..f35d3fc 100644 --- a/app/main.py +++ b/app/main.py @@ -22,7 +22,7 @@ from Crypto.PublicKey import RSA from Crypto.PublicKey.RSA import RsaKey logger = logging.getLogger() -load_dotenv('version.env') +load_dotenv('../version.env') VERSION, COMMIT, DEBUG = getenv('VERSION', 'unknown'), getenv('COMMIT', 'unknown'), bool(getenv('DEBUG', False))