-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (50 loc) · 1.61 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
FROM python:3.11-slim
# Build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
bash \
build-essential \
cmake \
curl \
dnsutils \
gcc \
libpq-dev \
nginx \
supervisor \
vim \
wget \
zip \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSLO "https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64" \
&& echo "cd48d45c4b10f3f0bfdd3a57d054cd05ac96812b supercronic-linux-amd64" | sha1sum -c - \
&& chmod +x supercronic-linux-amd64 \
&& mv supercronic-linux-amd64 /usr/local/bin/supercronic-linux-amd64 \
&& ln -s /usr/local/bin/supercronic-linux-amd64 /usr/local/bin/supercronic \
&& ln -sf /bin/bash /bin/sh
# Setup application root
RUN mkdir -p /app
WORKDIR /app
# Python requirements
COPY ./requirements.txt ./
RUN pip install -r ./requirements.txt
# Configure crontab schedules
COPY ./deploy/docker/crontab /etc/crontab
# Configure NGINX
COPY ./deploy/docker/nginx.conf /etc/nginx/nginx.conf
# Configure Supervisord
COPY ./deploy/docker/supervisord.conf /etc/supervisord.conf
# Init script
COPY ./deploy/docker/init.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh
# App source code
COPY . .
RUN mkdir -p files log
# Run container as non-root user and set permissions
RUN addgroup --gid 10001 docker \
&& adduser --disabled-password --uid 10001 --ingroup docker docker \
&& chown -R docker:docker /app /run /var/log /var/cache /var/lib
USER docker
EXPOSE 8042
# Init script
CMD ["/bin/bash", "-c", "init.sh"]