-
-
Notifications
You must be signed in to change notification settings - Fork 129
/
Dockerfile
62 lines (46 loc) · 1.62 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
61
62
# Set the base image
FROM continuumio/miniconda3:latest AS builder
# Install system dependencies
RUN apt-get update && \
apt-get install -y sudo libusb-1.0 python3-dev gcc && \
rm -rf /var/lib/apt/lists/*
WORKDIR /home/dashboard
# Create conda environment
COPY environment_conda.yml /tmp/environment_conda.yml
RUN conda env create -f /tmp/environment_conda.yml && \
conda clean -afy && \
rm /tmp/environment_conda.yml
# Copy remaining files
COPY . .
SHELL [ "/bin/bash", "-lc" ]
RUN echo "conda activate dashboard" >> ~/.bashrc
# Build final image using artifacts from builder
FROM continuumio/miniconda3:latest AS release
# Dockerfile author / maintainer
LABEL maintainer="Fede Cardoso @dardonacci <[email protected]>"
# Build arguments
ARG BRANCH=""
ARG COMMIT=""
ARG BUILD_DATE=""
LABEL branch=${BRANCH}
LABEL commit=${COMMIT}
LABEL date=${BUILD_DATE}
# Set ENV variables
ENV COMMIT_SHA=${COMMIT}
ENV COMMIT_BRANCH=${BRANCH}
ENV BUILD_DATE=${BUILD_DATE}
# Install system dependencies
RUN apt-get update && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists/*
# Create mount points
RUN mkdir -p /home/dashboard/data
WORKDIR /home/dashboard
# Copy all build artifacts from builder image
COPY --from=builder /opt/conda/ /opt/conda/
COPY --from=builder /home/ /home/
EXPOSE 8501
# Setting bash as default shell because we have .bashrc with customized PATH (setting SHELL affects RUN, CMD and ENTRYPOINT, but not manual commands e.g. `docker run image COMMAND`!)
SHELL [ "/bin/bash", "-lc" ]
# Set the default command to run when starting the container
CMD conda activate dashboard && streamlit run main.py