Skip to content

Commit

Permalink
Adding version number env param to image
Browse files Browse the repository at this point in the history
  • Loading branch information
PhillipsOwen committed Apr 20, 2023
1 parent 308d34d commit a943430
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/image-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
uses: docker/build-push-action@v3
with:
push: true
build-args: |
APP_VERSION=${{ steps.get_version.outputs.VERSION }}
tags: |
${{ env.REGISTRY }}:latest
${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ RUN apt-get clean
# get some credit
LABEL maintainer="[email protected]"

# get the build argument that has the version
ARG APP_VERSION=$(APP_VERSION)

# now add the version arg value into a ENV param
ENV APP_VERSION=$APP_VERSION

# Copy in just the requirements first for caching purposes
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
Expand Down
3 changes: 2 additions & 1 deletion src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import json
import os
import re
from pathlib import Path

Expand All @@ -23,7 +24,7 @@
from src.common.pg_impl import PGImplementation

# set the app version
APP_VERSION = 'v0.3.11'
APP_VERSION = os.getenv('APP_VERSION', 'Version number not set')

# declare the FastAPI details
APP = FastAPI(title='APSVIZ Settings', version=APP_VERSION)
Expand Down

0 comments on commit a943430

Please sign in to comment.