forked from dlops-io/data-versioning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·60 lines (46 loc) · 2.18 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
# Use the official Debian-hosted Python image
FROM python:3.11-slim-bookworm
ARG DEBIAN_PACKAGES="build-essential git curl wget unzip gzip"
# 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
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 install -y lsb-release && \
apt-get install -y --no-install-recommends software-properties-common apt-transport-https ca-certificates gnupg2 gnupg-agent curl openssh-client && \
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
echo "deb http://packages.cloud.google.com/apt gcsfuse-bionic main" > /etc/apt/sources.list.d/gcsfuse.list && \
apt-get update && \
apt-get install -y gcsfuse && \
apt-get install -y --no-install-recommends google-cloud-sdk && \
apt-get install -y libnss3 libcurl4 && \
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
RUN mkdir -p /mnt/gcs_data && chown app:app /mnt/gcs_data
# 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 ["pipenv","shell"]