diff --git a/.github/workflows/deployment_on_dockerhub.yml b/.github/workflows/deployment_on_dockerhub.yml index 50cae12f8..f7dfe75eb 100644 --- a/.github/workflows/deployment_on_dockerhub.yml +++ b/.github/workflows/deployment_on_dockerhub.yml @@ -28,7 +28,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push Docker image - run: docker build -t drorganvidez/uvlhub:${{ github.event.release.tag_name }} -f docker/images/Dockerfile.prod . + run: docker build --build-arg VERSION_TAG=${{ github.event.release.tag_name }} -t drorganvidez/uvlhub:${{ github.event.release.tag_name }} -f docker/images/Dockerfile.prod . env: DOCKER_CLI_EXPERIMENTAL: enabled @@ -36,7 +36,8 @@ jobs: run: docker push drorganvidez/uvlhub:${{ github.event.release.tag_name }} - name: Tag and push latest - run: docker tag drorganvidez/uvlhub:${{ github.event.release.tag_name }} drorganvidez/uvlhub:latest + run: | + docker tag drorganvidez/uvlhub:${{ github.event.release.tag_name }} drorganvidez/uvlhub:latest + docker push drorganvidez/uvlhub:latest env: DOCKER_CLI_EXPERIMENTAL: enabled - - run: docker push drorganvidez/uvlhub:latest diff --git a/.gitignore b/.gitignore index ed1de5bba..09afaa20a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ htmlcov/ venv/ ubuntu-bionic-18.04-cloudimg-console.log .vagrant/ -nginx.prod.ssl.conf \ No newline at end of file +nginx.prod.ssl.conf +.version \ No newline at end of file diff --git a/docker/images/Dockerfile.prod b/docker/images/Dockerfile.prod index 9b18281e2..ea6cb9c86 100644 --- a/docker/images/Dockerfile.prod +++ b/docker/images/Dockerfile.prod @@ -24,6 +24,11 @@ RUN pip install --no-cache-dir -r requirements.txt \ && pip install --no-cache-dir --upgrade pip \ && apk del .build-deps +# Add an argument for version tag +ARG VERSION_TAG + +# Create the .version file with the content of VERSION_TAG +RUN echo $VERSION_TAG > /app/.version # Expose port 5000 EXPOSE 5000