-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (30 loc) · 914 Bytes
/
Dockerfile
File metadata and controls
42 lines (30 loc) · 914 Bytes
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
FROM python:3-slim AS base
ARG USERNAME=sqliteuser
ARG UID=1001
ARG GID=1001
ARG HOME_DIR=/home/${USERNAME}
# Upgrade OS packages
RUN set -ex \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create the group and user
RUN groupadd --gid ${GID} ${USERNAME} \
&& useradd -m -u ${UID} -g ${GID} -d ${HOME_DIR} -s /bin/bash ${USERNAME}
RUN chown ${USER_NAME}:${USERNAME} ${HOME_DIR}
FROM base AS builder
COPY . /sqlite_rx
WORKDIR /svc
RUN pip install --upgrade pip
RUN pip install Cython
RUN pip install wheel && pip wheel --wheel-dir=/svc/wheels /sqlite_rx[cli]
RUN rm -rf /sqlite_rx
FROM base
COPY --from=builder /svc /svc
WORKDIR /svc
RUN pip install --upgrade pip
RUN pip install --no-index /svc/wheels/*.whl && mkdir /data && chown -R ${USERNAME}:${USERNAME} /data
USER ${USERNAME}
WORKDIR ${HOME_DIR}