-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
68 lines (41 loc) · 1.05 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
64
65
66
67
#
# Start with ubuntu+python image
#
FROM python:3.8.3-slim
#
# Setup non-root user and app directory
#
# Create non-root user account
RUN useradd -u 999 --system --shell=/bin/bash pigeon
# Create app directory
RUN mkdir -p /opt/app
RUN chown -R pigeon:pigeon /opt/app
# Switch to the non-root user and the app directory
USER pigeon
RUN id
WORKDIR /opt/app
#
# Create and setup the Python virtual environment
#
RUN python -m venv venv
# Upgrade pip inside the virtualenv due to pip bug with private repos
RUN venv/bin/pip install --no-cache-dir -U pip
# copy over sources and requirements file
COPY --chown=pigeon:pigeon requirements.txt requirements.txt
RUN venv/bin/pip install --no-cache-dir -r requirements.txt
#
# Add project sources
#
COPY --chown=pigeon:pigeon messenger messenger
#
# Add logs dir
#
RUN mkdir -p logs
## Expose port(s)
# UDP Port
EXPOSE 9089
EXPOSE 9090
# Stress test command
# CMD ["venv/bin/python", "-m", "messenger.test.stress.short_circuit_udp.inbound"]
# Default command
CMD ["venv/bin/python", "-m", "messenger"]