forked from sanderdw/Dutch-Gas-prices-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (47 loc) · 1.48 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
FROM ubuntu:bionic
LABEL maintainer="[email protected]"
# Required ystem packages and cleanup
RUN apt-get update \
&& apt-get install -y curl wget \
tesseract-ocr \
libtesseract-dev && apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Custom user to so we don't run under root
RUN useradd -ms /bin/bash apiuser
# Getting the latest miniconda installer and make the user owner
ADD https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh /home/apiuser/miniconda.sh
RUN chown apiuser /home/apiuser/miniconda.sh
# Switch to apiuser
USER apiuser
WORKDIR /home/apiuser
RUN mkdir /home/apiuser/.conda
RUN mkdir /home/apiuser/app
RUN mkdir /home/apiuser/app/cache
# Install miniconda
RUN /bin/bash /home/apiuser/miniconda.sh -b -p /home/apiuser/miniconda
ENV PATH=/home/apiuser/miniconda/bin:${PATH}
RUN conda update -y conda
# Install the conda packages
RUN conda config --add channels conda-forge
RUN conda install --yes \
python=3.7 \
fastapi=0.43.0 \
uvicorn=0.9.1 \
pip
# Install the pip packages
RUN pip install \
requests \
requests[socks] \
requests[security] \
fake_headers \
tesseract \
pytesseract \
Pillow
# Copy the python files to the image
COPY ./app/api.py /home/apiuser/app/api.py
COPY ./app/gas_prices.py /home/apiuser/app/gas_prices.py
WORKDIR /home/apiuser/app
# Expose 5035 port for API
EXPOSE 5035
# Run fastapi with the app (api.py)
CMD ["/bin/bash", "-c", "uvicorn --proxy-headers api:app --host=0.0.0.0 --port=5035"]