-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile_server
More file actions
42 lines (31 loc) · 1.03 KB
/
Dockerfile_server
File metadata and controls
42 lines (31 loc) · 1.03 KB
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
# base image
FROM python:3.9-slim
# setup environment variable
ENV DockerHOME=/home/app/webapp
# set work directory
RUN mkdir -p $DockerHOME
# where your code lives
WORKDIR $DockerHOME
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install dependencies
RUN pip install --upgrade pip
# Install necessary system libraries
RUN apt-get update \
&& apt-get install -y gcc
# copy whole project to your docker home directory.
COPY . $DockerHOME
RUN rm -rf $DockerHOME/src/main/python/client.py
RUN rm -rf $DockerHOME/run_client.py
RUN rm -rf $DockerHOME/src/main/python/sniffer.py
RUN rm -rf $DockerHOME/src/main/python/create_message.py
COPY ./src/main/python/configuration.ini $DockerHOME
# run this command to install all dependencies
RUN pip install --no-cache-dir -r ./requirements.txt
# port where the Django app runs
EXPOSE 12345
# start server
CMD ["python", "run_server.py", "0.0.0.0", "12345"]
# To build -> docker build -t server -f Dockerfile_server .
# To run -> docker run -p 12345:12345 server