forked from dlops-io/data-labeling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·50 lines (38 loc) · 1.4 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
# Use the official Debian-hosted Python image
FROM python:3.8-slim-buster
ARG DEBIAN_PACKAGES="build-essential git curl"
# Prevent apt from showing prompts
ENV DEBIAN_FRONTEND=noninteractive
# Python wants UTF-8 locale
ENV LANG=C.UTF-8
# Tell pipenv where the shell is. This allows us to use "pipenv shell" as a
# container entry point.
ENV PYENV_SHELL=/bin/bash
# Tell Python to disable buffering so we don't lose any logs.
ENV PYTHONUNBUFFERED=1
# Ensure we have an up to date baseline, install dependencies and
# create a user so we don't run the app as root
RUN set -ex; \
for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends $DEBIAN_PACKAGES && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip install --no-cache-dir --upgrade pip && \
pip install pipenv && \
useradd -ms /bin/bash app -d /home/app -u 1000 -p "$(openssl passwd -1 Passw0rd)" && \
mkdir -p /app && \
chown app:app /app
# Switch to the new user
USER app
WORKDIR /app
# Install python packages
ADD --chown=app:app Pipfile Pipfile.lock /app/
RUN pipenv sync
# Add the rest of the source code. This is done last so we don't invalidate all
# layers when we change a line of code.
ADD --chown=app:app . /app
# Entry point
#ENTRYPOINT ["/bin/bash","./docker-entrypoint.sh"]
ENTRYPOINT ["pipenv","shell"]