-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f18955e
commit 297dc6d
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
######## | ||
# Python dependencies builder | ||
# | ||
# Full official Debian-based Python image | ||
FROM python:3-stretch AS builder | ||
|
||
# Always set a working directory | ||
WORKDIR /app | ||
# Sets utf-8 encoding for Python et al | ||
ENV LANG=C.UTF-8 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
|
||
# Ensures that the python and pip executables used | ||
# in the image will be those from our virtualenv. | ||
ENV PATH="/venv/bin:$PATH" | ||
|
||
# Install OS package dependencies. | ||
# Do all of this in one RUN to limit final image size. | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Setup the virtualenv | ||
RUN python -m venv /venv | ||
|
||
# Install Python deps | ||
COPY requirements.txt ./ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
|
||
# Actual container | ||
# | ||
# | ||
FROM python:3-slim-stretch AS app | ||
|
||
# Extra python env | ||
ENV PATH="/venv/bin:$PATH" | ||
|
||
WORKDIR /app | ||
EXPOSE 8080 | ||
|
||
# copy in Python environment | ||
COPY --from=builder /venv /venv | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
libxml2 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# copy in the rest of the app | ||
COPY ./ ./ | ||
ENTRYPOINT [ "python" ] | ||
CMD ["ghstats.py"] |