Auto-inject version into image
This commit is contained in:
parent
123ed8aa15
commit
a4007d585b
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -33,7 +33,11 @@ jobs:
|
|||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
run: echo ${{ secrets.GHCR_ACCESS_TOKEN }} | docker login ghcr.io -u luketainton --password-stdin
|
run: echo ${{ secrets.GHCR_ACCESS_TOKEN }} | docker login ghcr.io -u luketainton --password-stdin
|
||||||
- name: Build image for GitHub Package Registry
|
- name: Build image for GitHub Package Registry
|
||||||
run: docker build . --file Dockerfile --tag ghcr.io/luketainton/roboluke-tasks:${{ needs.release.outputs.new_tag }} --tag ghcr.io/luketainton/roboluke-tasks:latest
|
run: |
|
||||||
|
docker build . --file Dockerfile \
|
||||||
|
--build-arg "version=${{ needs.release.outputs.new_tag }}" \
|
||||||
|
--tag ghcr.io/luketainton/roboluke-tasks:${{ needs.release.outputs.new_tag }} \
|
||||||
|
--tag ghcr.io/luketainton/roboluke-tasks:latest
|
||||||
- name: Push image to GitHub Package Registry
|
- name: Push image to GitHub Package Registry
|
||||||
run: |
|
run: |
|
||||||
docker push ghcr.io/luketainton/roboluke-tasks:latest
|
docker push ghcr.io/luketainton/roboluke-tasks:latest
|
||||||
|
@ -15,4 +15,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
|
|
||||||
ENTRYPOINT ["python3", "-B", "-m", "app.main"]
|
ENTRYPOINT ["python3", "-B", "-m", "app.main"]
|
||||||
|
|
||||||
|
ARG version="dev"
|
||||||
|
ENV APP_VERSION=$version
|
||||||
|
|
||||||
COPY app /run/app
|
COPY app /run/app
|
||||||
|
@ -8,6 +8,7 @@ class Config:
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Configuration module."""
|
"""Configuration module."""
|
||||||
self.__environment: str = os.environ.get("APP_LIFECYCLE", "DEV").upper()
|
self.__environment: str = os.environ.get("APP_LIFECYCLE", "DEV").upper()
|
||||||
|
self.__version: str = os.environ["APP_VERSION"]
|
||||||
self.__bot_name: str = os.environ["BOT_NAME"]
|
self.__bot_name: str = os.environ["BOT_NAME"]
|
||||||
self.__webex_token: str = os.environ["WEBEX_API_KEY"]
|
self.__webex_token: str = os.environ["WEBEX_API_KEY"]
|
||||||
self.__admin_first_name: str = os.environ["ADMIN_FIRST_NAME"]
|
self.__admin_first_name: str = os.environ["ADMIN_FIRST_NAME"]
|
||||||
@ -24,6 +25,11 @@ class Config:
|
|||||||
"""Returns the current app lifecycle."""
|
"""Returns the current app lifecycle."""
|
||||||
return self.__environment
|
return self.__environment
|
||||||
|
|
||||||
|
@property
|
||||||
|
def version(self) -> str:
|
||||||
|
"""Returns the current app version."""
|
||||||
|
return self.__version
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sentry_enabled(self) -> bool:
|
def sentry_enabled(self) -> bool:
|
||||||
"""Returns True if Sentry SDK is enabled, else False."""
|
"""Returns True if Sentry SDK is enabled, else False."""
|
||||||
|
Loading…
Reference in New Issue
Block a user