mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Automated all distribution files
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
docker build -t maloja-dev . -f Dockerfile-dev
|
||||
docker run -p 42010:42010 -v $PWD/testdata:/mlj -e MALOJA_DATA_DIRECTORY=/mlj maloja-dev
|
||||
docker build -t maloja . -f Dockerfile
|
||||
docker run --rm -p 42010:42010 -v $PWD/testdata:/mlj -e MALOJA_DATA_DIRECTORY=/mlj maloja
|
||||
|
||||
36
dev/templates/APKBUILD.jinja
Normal file
36
dev/templates/APKBUILD.jinja
Normal file
@@ -0,0 +1,36 @@
|
||||
# Contributor: Johannes Krattenmacher <maloja@dev.krateng.ch>
|
||||
# Maintainer: Johannes Krattenmacher <maloja@dev.krateng.ch>
|
||||
pkgname={{ tool.flit.module.name }}
|
||||
pkgver={{ project.version }}
|
||||
pkgrel=0
|
||||
pkgdesc="{{ project.description }}"
|
||||
url="{{ project.urls.homepage }}"
|
||||
arch="noarch"
|
||||
license="GPL-3.0"
|
||||
depends="{{ tool.osreqs.alpine.run | join(' ') }}"
|
||||
pkgusers=$pkgname
|
||||
pkggroups=$pkgname
|
||||
depends_dev="{{ tool.osreqs.alpine.build | join(' ') }}"
|
||||
makedepends="$depends_dev"
|
||||
source="
|
||||
$pkgname-$pkgver.tar.gz::{{ project.urls.repository }}/archive/refs/tags/v$pkgver.tar.gz
|
||||
"
|
||||
builddir="$srcdir"/$pkgname-$pkgver
|
||||
|
||||
|
||||
|
||||
build() {
|
||||
cd $builddir
|
||||
python3 -m build .
|
||||
pip3 install dist/*.tar.gz
|
||||
}
|
||||
|
||||
package() {
|
||||
mkdir -p /etc/$pkgname || return 1
|
||||
mkdir -p /var/lib/$pkgname || return 1
|
||||
mkdir -p /var/cache/$pkgname || return 1
|
||||
mkdir -p /var/logs/$pkgname || return 1
|
||||
}
|
||||
|
||||
# TODO
|
||||
sha512sums="a674eaaaa248fc2b315514d79f9a7a0bac6aa1582fe29554d9176e8b551e8aa3aa75abeebdd7713e9e98cc987e7bd57dc7a5e9a2fb85af98b9c18cb54de47bf7 $pkgname-${pkgver}.tar.gz"
|
||||
29
dev/templates/Dockerfile.jinja
Normal file
29
dev/templates/Dockerfile.jinja
Normal file
@@ -0,0 +1,29 @@
|
||||
FROM python:3-alpine
|
||||
|
||||
# Based on the work of Jonathan Boeckel <jonathanboeckel1996@gmail.com>
|
||||
# https://gitlab.com/Joniator/docker-maloja
|
||||
# https://github.com/Joniator
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# this should change rarely, can be cached
|
||||
COPY ./requirements.txt ./requirements.txt
|
||||
|
||||
# Install everything before copying rest of the project, can be cached
|
||||
RUN \
|
||||
apk add --no-cache --virtual .build-deps {{ tool.osreqs.alpine.build | join(' ') }} && \
|
||||
apk add --no-cache {{ tool.osreqs.alpine.run | join(' ') }} && \
|
||||
pip3 install --no-cache-dir -r requirements.txt && \
|
||||
apk del .build-deps
|
||||
|
||||
|
||||
COPY . .
|
||||
RUN pip3 install /usr/src/app
|
||||
|
||||
# Docker-specific configuration and default to IPv4
|
||||
ENV MALOJA_SKIP_SETUP=yes
|
||||
ENV MALOJA_HOST=0.0.0.0
|
||||
|
||||
EXPOSE 42010
|
||||
# use exec form for better signal handling https://docs.docker.com/engine/reference/builder/#entrypoint
|
||||
ENTRYPOINT ["maloja", "run"]
|
||||
6
dev/templates/install_alpine.sh.jinja
Normal file
6
dev/templates/install_alpine.sh.jinja
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
apk add \
|
||||
{{ tool.osreqs.alpine.build | join(' \\\n\t') }} \
|
||||
{{ tool.osreqs.alpine.run | join(' \\\n\t') }}
|
||||
pip3 install wheel
|
||||
pip3 install malojaserver
|
||||
3
dev/templates/requirements.txt.jinja
Normal file
3
dev/templates/requirements.txt.jinja
Normal file
@@ -0,0 +1,3 @@
|
||||
{% for dep in project.dependencies -%}
|
||||
{{ dep }}
|
||||
{% endfor %}
|
||||
3
dev/templates/requirements_extra.txt.jinja
Normal file
3
dev/templates/requirements_extra.txt.jinja
Normal file
@@ -0,0 +1,3 @@
|
||||
{% for dep in project['optional-dependencies'].full -%}
|
||||
{{ dep }}
|
||||
{% endfor %}
|
||||
24
dev/update_files.py
Normal file
24
dev/update_files.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import toml
|
||||
import os
|
||||
import jinja2
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
with open("pyproject.toml") as filed:
|
||||
data = toml.load(filed)
|
||||
|
||||
templatedir = "./dev/templates"
|
||||
|
||||
for templatefile in os.listdir(templatedir):
|
||||
|
||||
srcfile = os.path.join(templatedir,templatefile)
|
||||
trgfile = os.path.join(".",templatefile.replace(".jinja",""))
|
||||
|
||||
with open(srcfile) as templatefiled:
|
||||
template = jinja2.Template(templatefiled.read())
|
||||
|
||||
result = template.render(**data)
|
||||
|
||||
with open(trgfile,"w") as filed:
|
||||
filed.write(result)
|
||||
filed.write('\n')
|
||||
Reference in New Issue
Block a user