summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2022-03-03 23:33:35 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2022-08-21 17:19:58 +0200
commit6378f6ee6b43ef801725f3dda428cc10a68f26d4 (patch)
treebd0be0cfb9a5e8f67ec815640c9642fb0f489c82 /scripts
parentf8b4ef76980e1daac46e00f94941de50c0debbb6 (diff)
downloadpoezio-6378f6ee6b43ef801725f3dda428cc10a68f26d4.tar.gz
poezio-6378f6ee6b43ef801725f3dda428cc10a68f26d4.tar.bz2
poezio-6378f6ee6b43ef801725f3dda428cc10a68f26d4.tar.xz
poezio-6378f6ee6b43ef801725f3dda428cc10a68f26d4.zip
roezio: rework .gitlab-ci.yml
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate_container42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/generate_container b/scripts/generate_container
new file mode 100755
index 00000000..fc01a0ee
--- /dev/null
+++ b/scripts/generate_container
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# vim:fenc=utf-8 et ts=4 sts=4 sw=4
+#
+# Copyright © 2022 Maxime “pep” Buquet <pep@bouah.net>
+#
+# Distributed under terms of the GPLv3+ license.
+
+"""
+ Generate Dockerfiles for our CI containers.
+
+ The output can be used in the following way:
+ ```
+ docker login docker.louiz.org
+ CONTAINER=docker.louiz.org/poezio/poezio:rust-python3.10
+ python generate_container 3.10 | docker -t $CONTAINER -
+ docker push $CONTAINER
+ ```
+"""
+
+import sys
+
+TEMPLATE='''FROM rust:slim
+RUN set -eux; \
+ apt update; \
+ apt install -y --no-install-recommends git libidn11-dev libncurses-dev; \
+ rm -rf /var/lib/apt/lists/*
+RUN rustup component add clippy rustfmt
+COPY --from=python:VERSION-slim /usr/ /usr/
+COPY --from=python:VERSION-slim /lib/ /lib/
+RUN ldconfig'''
+
+REGISTRY='docker.louiz.org'
+CONTAINER='poezio/poezio'
+TAG='rust-python{version}'
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ print('./generate_container.py <python version>', file=sys.stderr)
+ sys.exit(1)
+
+ print(TEMPLATE.replace('VERSION', sys.argv[1]))