Skip to content

Commit f6e8f13

Browse files
Packaging (#1)
* UI is built * Python package is built for service * Python package contains UI, templates and resources, so is totally standalone * Container build
1 parent 5ee17f3 commit f6e8f13

18 files changed

+473
-254
lines changed

Containerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
FROM alpine:3.20 AS build
3+
4+
RUN apk add --update --no-cache --no-progress make g++ gcc linux-headers
5+
6+
RUN apk add --update --no-cache --no-progress python3 py3-pip py3-wheel \
7+
python3-dev
8+
9+
RUN mkdir /root/wheels
10+
11+
RUN pip wheel -w /root/wheels --no-deps jsonnet
12+
13+
COPY simple-config-ui /root/simple-config-ui/
14+
15+
RUN (cd /root/simple-config-ui && pip wheel -w /root/wheels --no-deps .)
16+
17+
FROM alpine:3.20
18+
19+
ENV PIP_BREAK_SYSTEM_PACKAGES=1
20+
21+
COPY --from=build /root/wheels /root/wheels
22+
23+
RUN apk add --update --no-cache --no-progress python3 py3-pip \
24+
py3-aiohttp
25+
26+
RUN pip install /root/wheels/* && \
27+
pip cache purge && \
28+
rm -rf /root/wheels
29+
30+
CMD service
31+
EXPOSE 8080
32+

Makefile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
VERSION=0.1.0
3+
4+
all: service-package container
5+
6+
ui:
7+
npm run build
8+
rm -rf simple-config-ui/config_ui/ui/
9+
cp -r dist/ simple-config-ui/config_ui/ui/
10+
11+
template-data:
12+
rm -rf simple-config-ui/config_ui/templates
13+
mkdir -p simple-config-ui/config_ui/templates
14+
find templates -name '*.jsonnet' | cpio -pdm simple-config-ui/config_ui/
15+
16+
resources-data:
17+
rm -rf simple-config-ui/config_ui/resources
18+
mkdir -p simple-config-ui/config_ui/resources
19+
cp -r grafana simple-config-ui/config_ui/resources/
20+
cp -r prometheus simple-config-ui/config_ui/resources/
21+
22+
service-package: ui template-data resources-data update-package-versions
23+
cd simple-config-ui && python3 setup.py sdist --dist-dir ../pkgs/
24+
25+
update-package-versions:
26+
echo __version__ = \"${VERSION}\" > simple-config-ui/config_ui/version.py
27+
28+
CONTAINER=docker.io/trustgraph/simple-config-ui
29+
DOCKER=podman
30+
31+
container:
32+
${DOCKER} build -f Containerfile -t ${CONTAINER}:${VERSION} \
33+
--format docker
34+

service

-200
This file was deleted.

simple-config-ui/README.md

Whitespace-only changes.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
from . generator import Generator
3+
from . api import Api
4+
from . service import run
5+
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env python3
2+
3+
from . service import run
4+
5+
if __name__ == '__main__':
6+
run()
7+

0 commit comments

Comments
 (0)