-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_with_conda
56 lines (41 loc) · 1.39 KB
/
Dockerfile_with_conda
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
# docker build --progress=plain --no-cache -t market-forecast .
# docker save -o market-forecast.tar market-forecast
# docker load --input market-forecast.tar
FROM continuumio/miniconda3 AS build
# Updating conda
RUN conda update -n base -c defaults conda
# Installing git in case required by conda
RUN apt install git
WORKDIR /app
COPY . .
# Creating the environment
RUN conda env create -f _environment.yml
# Installing conda-pack
RUN conda install -c conda-forge conda-pack
# Use conda-pack to create a standalone environment
# in /venv:
RUN conda-pack -n stock-market -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
# We've put venv in the same path it'll be in the final image,
# so now fix up paths:
RUN /venv/bin/conda-unpack
# RUN conda clean -a -y
# The runtime-stage image
FROM debian:buster AS runtime
LABEL version="1.0.0"
LABEL maintainer="Kaveh Bakhtiyari"
LABEL url="http://bakhtiyari.com"
LABEL vcs-url="https://github.com/kavehbc/market-forecast"
LABEL description="Cryptocurrency and Stocks Exchange Market Forecast"
# Copy /venv from the previous stage
COPY --from=build /venv /venv
# Copy /app from the previous stage
COPY --from=build /app /app
WORKDIR /app
EXPOSE 8501
# Run the code with the environment activated
SHELL ["/bin/bash", "-c"]
# change file permission to prevent access denied error
RUN chmod +x run.bash
ENTRYPOINT ["./run.bash"]