-
Notifications
You must be signed in to change notification settings - Fork 33
/
Dockerfile
78 lines (62 loc) · 2.39 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM python:3.8.12-slim-bullseye AS builder
RUN useradd -u 1001 -G root app && \
chgrp -R 0 /etc/passwd && \
chmod -R g=u /etc/passwd && \
mkdir /app && \
chgrp -R 0 /app && \
chmod -R g=u /app
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
build-essential \
gcc
ARG PIP_VERSION="pip==22.3.0"
ARG SETUPTOOL_VERSION="setuptools==65.5.0"
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN python3 -m pip install ${PIP_VERSION} ${SETUPTOOL_VERSION}
# --- cjvalpy build from source because https://github.com/cityjson/cjio/issues/146
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"
RUN pip install maturin
ARG CJVALPY_VERSION="0.3.2"
RUN curl -L -o cjvalpy.tar.gz https://github.com/cityjson/cjvalpy/archive/refs/tags/${CJVALPY_VERSION}.tar.gz && \
tar -xvf cjvalpy.tar.gz && \
cd cjvalpy-${CJVALPY_VERSION} && \
maturin build --release && \
cd ./target/wheels/
ARG WHEEL="cjvalpy-${CJVALPY_VERSION}/target/wheels/*.whl"
RUN pip install ${WHEEL} && \
pip uninstall -y maturin
# ---
COPY setup.py setup.cfg README.rst LICENSE CHANGELOG.md /app/
COPY cjio /app/cjio
RUN cd /app && \
pip install .[export,validate,reproject] && \
rm -rf /tmp/* && \
rm -rf /user/local/man && \
cjio --version
FROM python:3.8.12-slim AS cjio
LABEL org.opencontainers.image.authors="Balázs Dukai <[email protected]>"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.url="https://github.com/cityjson/cjio"
LABEL org.opencontainers.image.description="Python CLI to process and manipulate CityJSON files. The different operators can be chained to perform several processing operations in one step, the CityJSON model goes through them and different versions of the CityJSON model can be saved as files along the pipeline."
LABEL org.opencontainers.image.title="cjio"
RUN useradd -u 1001 -G root -s /bin/bash app && \
chgrp -R 0 /etc/passwd && \
chmod -R g=u /etc/passwd && \
mkdir /app && \
chgrp -R 0 /app && \
chmod -R g=u /app
COPY --from=builder /opt/venv /opt/venv
COPY --chown=1001:0 uid_entrypoint.sh /usr/local/bin/
ENV PATH="/opt/venv/bin:$PATH"
RUN mkdir /data && \
chown 1001 /data && \
chgrp 0 /data && \
chmod g=u /data
WORKDIR /data
ENV LANG="C.UTF-8"
USER 1001
ENTRYPOINT ["/usr/local/bin/uid_entrypoint.sh"]
CMD ["cjio"]