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:
parent
7b89d227a3
commit
e3dc401ccf
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
*
|
||||||
|
!/maloja
|
||||||
|
!Dockerfile
|
||||||
|
!/requirements.txt
|
||||||
|
!/pyproject.toml
|
||||||
|
!/README.md
|
||||||
|
!/LICENSE
|
21
APKBUILD
21
APKBUILD
@ -1,21 +1,21 @@
|
|||||||
# Contributor: Johannes Krattenmacher <maloja@dev.krateng.ch>
|
# Contributor: Johannes Krattenmacher <maloja@dev.krateng.ch>
|
||||||
# Maintainer: Johannes Krattenmacher <maloja@dev.krateng.ch>
|
# Maintainer: Johannes Krattenmacher <maloja@dev.krateng.ch>
|
||||||
pkgname=maloja
|
pkgname=maloja
|
||||||
pkgver=2.14.6
|
pkgver=3.0.0-dev
|
||||||
pkgrel=0
|
pkgrel=0
|
||||||
pkgdesc="Scrobble statistics server"
|
pkgdesc="Self-hosted music scrobble database"
|
||||||
url="https://github.com/krateng/maloja"
|
url="https://github.com/krateng/maloja"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
license="GPL-3.0"
|
license="GPL-3.0"
|
||||||
depends="python3 tzdata vips"
|
depends="python3 tzdata vips"
|
||||||
pkgusers=$pkgname
|
pkgusers=$pkgname
|
||||||
pkggroups=$pkgname
|
pkggroups=$pkgname
|
||||||
depends_dev="gcc python3-dev libxml2-dev libxslt-dev libffi-dev libc-dev py3-pip linux-headers py3-build"
|
depends_dev="gcc python3-dev libxml2-dev libxslt-dev libffi-dev libc-dev py3-pip linux-headers"
|
||||||
makedepends="$depends_dev"
|
makedepends="$depends_dev"
|
||||||
source="
|
source="
|
||||||
maloja-$pkgver.tar.gz::https://github.com/krateng/maloja/archive/refs/tags/v$pkgver.tar.gz
|
$pkgname-$pkgver.tar.gz::https://github.com/krateng/maloja/archive/refs/tags/v$pkgver.tar.gz
|
||||||
"
|
"
|
||||||
builddir="$srcdir"/maloja-$pkgver
|
builddir="$srcdir"/$pkgname-$pkgver
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -26,10 +26,11 @@ build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
mkdir -p /etc/maloja || return 1
|
mkdir -p /etc/$pkgname || return 1
|
||||||
mkdir -p /var/lib/maloja || return 1
|
mkdir -p /var/lib/$pkgname || return 1
|
||||||
mkdir -p /var/cache/maloja || return 1
|
mkdir -p /var/cache/$pkgname || return 1
|
||||||
mkdir -p /var/logs/maloja || return 1
|
mkdir -p /var/logs/$pkgname || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="a674eaaaa248fc2b315514d79f9a7a0bac6aa1582fe29554d9176e8b551e8aa3aa75abeebdd7713e9e98cc987e7bd57dc7a5e9a2fb85af98b9c18cb54de47bf7 maloja-${pkgver}.tar.gz"
|
# TODO
|
||||||
|
sha512sums="a674eaaaa248fc2b315514d79f9a7a0bac6aa1582fe29554d9176e8b551e8aa3aa75abeebdd7713e9e98cc987e7bd57dc7a5e9a2fb85af98b9c18cb54de47bf7 $pkgname-${pkgver}.tar.gz"
|
||||||
|
26
Dockerfile
26
Dockerfile
@ -6,23 +6,21 @@ FROM python:3-alpine
|
|||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# this should change rarely, can be cached
|
||||||
|
COPY ./requirements.txt ./requirements.txt
|
||||||
|
|
||||||
# Copy project into dir
|
# Install everything before copying rest of the project, can be cached
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
# Build dependencies (This will pipe all packages from the file)
|
apk add --no-cache --virtual .build-deps gcc python3-dev libxml2-dev libxslt-dev libffi-dev libc-dev py3-pip linux-headers && \
|
||||||
sed 's/#.*//' ./install/dependencies_build.txt | xargs apk add --no-cache --virtual .build-deps && \
|
apk add --no-cache python3 tzdata vips && \
|
||||||
# Runtime dependencies (Same)
|
pip3 install --no-cache-dir -r requirements.txt && \
|
||||||
sed 's/#.*//' ./install/dependencies_run.txt | xargs apk add --no-cache && \
|
apk del .build-deps
|
||||||
# Python dependencies
|
|
||||||
pip3 install --no-cache-dir -r requirements.txt && \
|
|
||||||
# Local project install
|
|
||||||
pip3 install /usr/src/app && \
|
|
||||||
# Remove build dependencies
|
|
||||||
apk del .build-deps
|
|
||||||
|
|
||||||
# expected behavior for a default setup is for maloja to "just work"
|
|
||||||
|
COPY . .
|
||||||
|
RUN pip3 install /usr/src/app
|
||||||
|
|
||||||
|
# Docker-specific configuration and default to IPv4
|
||||||
ENV MALOJA_SKIP_SETUP=yes
|
ENV MALOJA_SKIP_SETUP=yes
|
||||||
ENV MALOJA_HOST=0.0.0.0
|
ENV MALOJA_HOST=0.0.0.0
|
||||||
|
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
# Copy project into dir
|
|
||||||
COPY ./install ./install
|
|
||||||
COPY ./requirements.txt ./requirements.txt
|
|
||||||
|
|
||||||
|
|
||||||
# Build dependencies (This will pipe all packages from the file)
|
|
||||||
RUN sed 's/#.*//' ./install/dependencies_build.txt | xargs apk add --no-cache --virtual .build-deps
|
|
||||||
# Runtime dependencies (Same)
|
|
||||||
RUN sed 's/#.*//' ./install/dependencies_run.txt | xargs apk add --no-cache
|
|
||||||
# Python dependencies
|
|
||||||
RUN pip3 install --no-cache-dir -r requirements.txt
|
|
||||||
# Local project install
|
|
||||||
COPY ./maloja ./maloja
|
|
||||||
COPY ./pyproject.toml ./pyproject.toml
|
|
||||||
COPY ./README.md ./README.md
|
|
||||||
COPY ./LICENSE ./LICENSE
|
|
||||||
RUN pip3 install /usr/src/app
|
|
||||||
# Remove build dependencies
|
|
||||||
RUN apk del .build-deps
|
|
||||||
|
|
||||||
# expected behavior for a default setup is for maloja to "just work"
|
|
||||||
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"]
|
|
@ -1,31 +0,0 @@
|
|||||||
FROM python:3-alpine
|
|
||||||
|
|
||||||
# Based on the work of Jonathan Boeckel <jonathanboeckel1996@gmail.com>
|
|
||||||
# https://gitlab.com/Joniator/docker-maloja
|
|
||||||
# https://github.com/Joniator
|
|
||||||
|
|
||||||
ARG MALOJA_RELEASE
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
# Copy needed information
|
|
||||||
COPY ./install ./install
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
# Build dependencies (This will pipe all packages from the file)
|
|
||||||
sed 's/#.*//' ./install/dependencies_build.txt | xargs apk add --no-cache --virtual .build-deps && \
|
|
||||||
# Runtime dependencies (Same)
|
|
||||||
sed 's/#.*//' ./install/dependencies_run.txt | xargs apk add --no-cache && \
|
|
||||||
|
|
||||||
|
|
||||||
# PyPI install
|
|
||||||
pip3 install malojaserver==$MALOJA_RELEASE && \
|
|
||||||
# Remove build dependencies
|
|
||||||
apk del .build-deps
|
|
||||||
|
|
||||||
# expected behavior for a default setup is for maloja to "just work"
|
|
||||||
ENV MALOJA_SKIP_SETUP=yes
|
|
||||||
ENV MAGICK_HOME=/usr
|
|
||||||
|
|
||||||
EXPOSE 42010
|
|
||||||
# use exec form for better signal handling https://docs.docker.com/engine/reference/builder/#entrypoint
|
|
||||||
ENTRYPOINT ["maloja", "run"]
|
|
@ -1,2 +1,2 @@
|
|||||||
docker build -t maloja-dev . -f Dockerfile-dev
|
docker build -t maloja . -f Dockerfile
|
||||||
docker run -p 42010:42010 -v $PWD/testdata:/mlj -e MALOJA_DATA_DIRECTORY=/mlj maloja-dev
|
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')
|
@ -1,14 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
apk add \
|
apk add \
|
||||||
python3 \
|
|
||||||
python3-dev \
|
|
||||||
gcc \
|
gcc \
|
||||||
|
python3-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
libxslt-dev \
|
libxslt-dev \
|
||||||
libffi-dev \
|
libffi-dev \
|
||||||
libc-dev \
|
libc-dev \
|
||||||
py3-pip \
|
py3-pip \
|
||||||
linux-headers \
|
linux-headers \
|
||||||
|
python3 \
|
||||||
tzdata \
|
tzdata \
|
||||||
vips
|
vips
|
||||||
pip3 install wheel
|
pip3 install wheel
|
||||||
|
@ -33,6 +33,11 @@ dependencies = [
|
|||||||
"python-datauri>=1.1.0"
|
"python-datauri>=1.1.0"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
full = [
|
||||||
|
"pyvips>=2.1"
|
||||||
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
maloja = "maloja.proccontrol.control:main"
|
maloja = "maloja.proccontrol.control:main"
|
||||||
|
|
||||||
@ -42,3 +47,20 @@ build-backend = "flit_core.buildapi"
|
|||||||
|
|
||||||
[tool.flit.module]
|
[tool.flit.module]
|
||||||
name = "maloja"
|
name = "maloja"
|
||||||
|
|
||||||
|
[tool.osreqs.alpine]
|
||||||
|
build =[
|
||||||
|
"gcc",
|
||||||
|
"python3-dev",
|
||||||
|
"libxml2-dev",
|
||||||
|
"libxslt-dev",
|
||||||
|
"libffi-dev",
|
||||||
|
"libc-dev",
|
||||||
|
"py3-pip",
|
||||||
|
"linux-headers"
|
||||||
|
]
|
||||||
|
run = [
|
||||||
|
"python3",
|
||||||
|
"tzdata",
|
||||||
|
"vips"
|
||||||
|
]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
bottle>=0.12.16
|
bottle>=0.12.16
|
||||||
waitress>=1.3
|
waitress>=1.3
|
||||||
doreah>=1.7.4
|
doreah>=1.7.4, <2
|
||||||
nimrodel>=0.7.0
|
nimrodel>=0.7.0
|
||||||
setproctitle>=1.1.10
|
setproctitle>=1.1.10
|
||||||
jinja2>=2.11
|
jinja2>=2.11
|
||||||
@ -9,3 +9,4 @@ css_html_js_minify>=2.5.5
|
|||||||
psutil>=5.8.0
|
psutil>=5.8.0
|
||||||
sqlalchemy>=1.4
|
sqlalchemy>=1.4
|
||||||
python-datauri>=1.1.0
|
python-datauri>=1.1.0
|
||||||
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
pyvips>=2.1
|
pyvips>=2.1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user