-
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
Showing
4 changed files
with
93 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,38 @@ | ||
FROM python:3.10-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++ | ||
|
||
# Install python dependencies in /.venv | ||
COPY Pipfile . | ||
RUN PIPENV_VENV_IN_PROJECT=1 pipenv run pip install Cython | ||
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 | ||
ENV PATH="/.venv/bin:$PATH" | ||
|
||
# Create and switch to a new user | ||
RUN useradd --create-home app | ||
WORKDIR /home/app | ||
USER app |
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,20 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
Cython = "*" | ||
chardet = "*" | ||
pyyaml = "*" | ||
colorama = "*" | ||
pygments = "*" | ||
pytz = "*" | ||
python-dateutil = "*" | ||
Mako = "*" | ||
emonoda = {editable = true, ref = "v${VERSION}", git = "git+https://github.com/mdevaev/emonoda.git"} | ||
|
||
[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,23 @@ | ||
#!/usr/bin/env python | ||
|
||
import requests | ||
import json | ||
import semver | ||
|
||
|
||
# Get the latest version of matchbox | ||
|
||
URL = "https://api.github.com/repos/mdevaev/emonoda/tags" | ||
|
||
def get_latest(channel): | ||
r = requests.get(URL) | ||
data = json.loads(r.text) | ||
versions = [ semver.Version.parse(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: "emonoda" | ||
base: false | ||
semantic_versioning: true | ||
channels: | ||
- name: "stable" | ||
platforms: | ||
- linux/arm64 | ||
- linux/amd64 | ||
stable: true | ||
tests: | ||
enabled: false |