-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (30 loc) · 989 Bytes
/
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
FROM python:3.9.6-slim as build
WORKDIR /opt/memebot/
# Install requirements.
COPY requirements.txt requirements.txt
RUN \
apt-get update -y && \
# gcc is required to build package aiohttp (https://docs.aiohttp.org/en/stable/) required by discord.py
apt-get install --no-install-recommends -y gcc=4:10.2.1-1 && \
# Remove apt lists
rm -rf /var/lib/apt/lists/*
# Set up venv.
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN python3 -m pip install --no-cache-dir -r requirements.txt
FROM build as build-test
COPY tests tests
RUN python3 -m pip install --no-cache-dir -r tests/requirements.txt
# Prepare run image.
FROM python:3.9.6-slim as run-base
WORKDIR /opt/memebot/
ENV PATH="/opt/venv/bin:$PATH"
COPY memebot memebot
ENTRYPOINT ["python3", "memebot/main.py"]
# Run release build.
FROM run-base as release
COPY --from=build /opt/venv /opt/venv
# Run test build.
FROM run-base as test
COPY tests tests
COPY --from=build-test /opt/venv /opt/venv