forked from Kashyapdevesh/Flight_Delay_Prediction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (46 loc) · 2 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
63
# FROM ubuntu uncomment if you want to use ubuntu
#FROM ubuntu:latest
#RUN apt-get -y update
# Install pip and git
#RUN apt-get update && apt-get install --assume-yes --fix-missing python-pip git
# Clone repository to /app folder in the container image
#RUN git clone https://github.com/Kashyapdevesh/Flight_Delay_Prediction.git /app
#####################################################################################################################
FROM python:3
# Mount current directory to /app in the container image
#VOLUME ./:app/
# Copy local directory to /app in container
# Dont use COPY * /app/ , * will lead to lose of folder structure in /app
#COPY . /app/
RUN apt-get -y update && apt-get install -y --no-install-recommends \
nginx \
&& rm -rf /var/lib/apt/lists/*
COPY conf/nginx.conf /etc/nginx/sites-enabled/default
# Change WORKDIR
WORKDIR /app/
# Install dependencies
# use --proxy http://<proxy host>:port if you have proxy
COPY requirements.txt /app/
RUN pip install -r ./requirements.txt
COPY api.py /app/
COPY model/Model.pkl /app/model/
COPY model/scaler.pkl /app/model/
COPY ./airports.json /app/
# In Docker, the containers themselves can have applications running on ports. To access these applications, we need to expose the containers internal port and bind the exposed port to a specified port on the host.
# Expose port and run the application when the container is started
#EXPOSE 5004
#ENTRYPOINT python ./api.py #TESTING ON LOCAL SERVER
# CMD ["api.py"]
CMD service nginx start && uwsgi -s /tmp/uwsgi.sock --chmod-socket=666 --manage-script-name --mount /=server:app
# docker build
#docker build -t "<app name>" .
# docker run
#docker run ml_app -p 9999 # to make the port externally avaiable for browsers
# show all running containers
#docker ps
# Kill and remove running container
# docker rm <containerid> -f
# open bash in a running docker container
# docker exec -ti <containerid> bash
# docker compose
# run and interact between multiple docker containers