-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
40 lines (29 loc) · 1.02 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
# build with --squash flag, needs "experimental": true to be set in daemon.json
#
FROM python:3-alpine AS builder
COPY . /opt/bot
WORKDIR /opt/bot
RUN apk upgrade --no-cache
RUN apk add --no-cache build-base openssl openssl-dev libffi libffi-dev sqlite
# hadolint ignore=SC1091
RUN python -m venv venv \
&& . ./venv/bin/activate \
&& python -m pip install --upgrade pip wheel \
&& pip install --no-cache-dir -r requirements.txt -e .
# ===
FROM python:3-alpine
RUN apk upgrade --no-cache
RUN apk add --no-cache bash openssl libffi fortune sqlite
RUN adduser potato --disabled-password \
--shell /bin/false \
--home /opt/bot \
--no-create-home
WORKDIR /opt/bot
COPY --from=builder /opt/bot/entrypoint.sh .
COPY --from=builder /opt/bot/devpotato_bot devpotato_bot
COPY --from=builder /opt/bot/alembic.ini .
COPY --from=builder /opt/bot/alembic alembic
COPY --from=builder /opt/bot/venv venv
COPY --from=builder /opt/bot/LICENSE .
USER potato
ENTRYPOINT ["/opt/bot/entrypoint.sh"]