-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
39 lines (29 loc) · 1.01 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
# Use an official Python runtime as a parent image
ARG PYTHON_VERSION=3.9
FROM python:${PYTHON_VERSION}-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100
# Set the working directory in the container
WORKDIR /app
# Create a virtual environment
RUN python -m venv /venv
# Copy the current directory contents into the container at /app
COPY . .
# Install packages specified in setup.py and nodejs-bin
RUN /venv/bin/pip install . && \
/venv/bin/pip install 'nodejs-bin[cmd]'
# Remove the source files to keep the container clean
RUN rm -rf /app/*
# Create a non-root user
RUN mkdir /appuser && \
groupadd -r -g 1001 appuser && \
useradd -r -u 1001 -g appuser -d /appuser appuser && \
chown -R appuser:appuser /app /appuser /venv
USER appuser
ENV PATH="/venv/bin:$PATH"
# Expose port and run zero-true app when the container launches
EXPOSE 1326
CMD ["zero-true", "notebook", "--host=0.0.0.0", "--remote"]