-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.org-python
61 lines (50 loc) · 1.62 KB
/
Dockerfile.org-python
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
FROM debian:bookworm-slim AS python-bookworm-slim
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
build-essential \
debhelper \
dh-virtualenv \
dh-python \
python3 \
python3.11 \
python3-dev \
python3-pip \
python3-setuptools \
python3-venv \
libprotobuf-dev \
protobuf-compiler \
git \
; \
rm -rf /var/lib/apt/lists/*;
# ----------------------------------
FROM python-bookworm-slim AS build
# Install system packages
RUN apt-get -qy update >/dev/null
RUN apt-get -qy install make git >/dev/null
RUN apt-get -qy install sqlite3 >/dev/null
# Build deps
# RUN apt-get -qy install libssl-dev >/dev/null
# RUN apt-get -qy install libsqlite3-dev >/dev/null
RUN apt-get -qy install protobuf-compiler >/dev/null
# Deb build deps
RUN apt-get -qy install dh-virtualenv >/dev/null
# Create regular user
ARG USER=docker
ARG UID=1000
ARG GID=1000
RUN echo "#### USER=${USER}, UID=${UID}, GID=${GID}"
RUN test -n "${USER}" && test -n "${UID}" && test -n "${GID}"
RUN groupadd -f ${USER} --gid=${GID}
RUN useradd -m ${USER} --uid=${UID} --gid=${GID} || true
RUN mkdir -p /build
RUN chown -R ${UID}:${GID} /build
USER ${UID}:${GID}
RUN mkdir -p /build/organizer/basic_folders
RUN mkdir -p /build/protobuf/libs/python
# Copy sources
COPY --chown=${UID}:${GID} protobuf/proto /build/protobuf/proto
COPY --chown=${UID}:${GID} protobuf/libs/python /build/protobuf/libs/python
COPY --chown=${UID}:${GID} organizer/basic_folders /build/organizer/basic_folders
WORKDIR /build/organizer/basic_folders
RUN ln -s ../ dist_deb