-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mark Glants
committed
Oct 2, 2024
1 parent
2215cde
commit 3d64d52
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM python:3.12-slim as base | ||
|
||
# Setup env | ||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONFAULTHANDLER 1 | ||
|
||
|
||
FROM base AS python-deps | ||
ARG VERSION | ||
# Install pipenv and compilation dependencies | ||
RUN pip install pipenv | ||
RUN apt-get update && apt-get install -y --no-install-recommends gcc git g++ | ||
RUN git clone --depth 1 --branch ${VERSION} https://github.com/BBQigniter/kube-vip-watcher.git /src | ||
RUN chmod +x /src/*.py | ||
RUN chmod +x /src/healthchecks/*.py | ||
# Install python dependencies in /.venv | ||
COPY Pipfile . | ||
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy | ||
|
||
|
||
FROM base AS runtime | ||
ARG TARGETPLATFORM | ||
ARG TARGETARCH | ||
ARG TARGETOS | ||
LABEL xyz.glants.image.target_platform=$TARGETPLATFORM | ||
LABEL xyz.glants.image.target_architecture=$TARGETARCH | ||
LABEL xyz.glants.image.target_os=$TARGETOS | ||
LABEL org.opencontainers.image.title="emonoda" | ||
LABEL org.opencontainers.image.source="https://github.com/mdevaev/emonoda" | ||
# Copy virtual env from python-deps stage | ||
COPY --from=python-deps /.venv /.venv | ||
COPY --from=python-deps /src/kube-vip-watcher.py /app/ | ||
COPY --from=python-deps /src/healthchecks /app/ | ||
COPY --from=python-deps /src/lib /app/lib/ | ||
|
||
ENV PATH="/.venv/bin:/app:$PATH" | ||
|
||
# Create and switch to a new user | ||
RUN useradd --create-home app | ||
WORKDIR /home/app | ||
USER app | ||
ENTRYPOINT ["kube-vip-watcher.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
kubernetes = "*" | ||
psutil = "*" | ||
coloredlogs = "*" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
import requests | ||
import json | ||
|
||
# Get the latest version of matchbox | ||
|
||
URL = "https://api.github.com/repos/BBQigniter/kube-vip-watcher/tags" | ||
|
||
def get_latest(channel): | ||
r = requests.get(URL) | ||
data = json.loads(r.text) | ||
versions = [ release['name'].replace('v', '') for release in data ] | ||
latest_version = max(versions) | ||
|
||
return str(latest_version) | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
channel = sys.argv[1] | ||
print(get_latest(channel)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
app: "kube-vip-watcher" | ||
base: false | ||
semantic_versioning: true | ||
channels: | ||
- name: "stable" | ||
platforms: | ||
- linux/arm64 | ||
- linux/amd64 | ||
stable: true | ||
tests: | ||
enabled: false |