-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (32 loc) · 1.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
# Accept Python version during build
ARG PYTHON_VERSION="3.8"
FROM python:${PYTHON_VERSION}-slim
# Install OS dependencies
RUN apt-get update && apt-get -y upgrade \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends curl build-essential
# Create a non-root user
RUN useradd --create-home appuser
USER appuser
WORKDIR /home/appuser/app
# Install Wave
ARG WAVE_VERSION="0.21.1"
ENV WAVE_HOME="/home/appuser/wave"
RUN \
mkdir -p "${WAVE_HOME}" && \
curl -fsSL https://github.com/h2oai/wave/releases/download/v${WAVE_VERSION}/wave-${WAVE_VERSION}-linux-amd64.tar.gz | tar -C ${WAVE_HOME} -xzv 2>&1
ENV WAVE_PATH="${WAVE_HOME}/wave-${WAVE_VERSION}-linux-amd64"
# Create a virtual environment
ENV VIRTUAL_ENV=/home/appuser/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install Python dependencies
COPY requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY --chown=appuser:appuser . .
# Set permissions for the Entrypoint script
RUN chmod +x docker-entrypoint.sh
ARG PYTHON_MODULE
ENV PYTHON_MODULE="${PYTHON_MODULE}"
ENTRYPOINT [ "./docker-entrypoint.sh" ]