-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (36 loc) · 1.42 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
## Base image with python and entrypoint scripts ##
## ============================================= ##
FROM python:3.6.9-alpine3.9 AS base
LABEL maintainer="Adam Hodges <[email protected]>"
ENV LANG C.UTF-8
ENV PYTHONUNBUFFERED 1
# Essential packages for our app environment
RUN apk add --no-cache bash curl binutils linux-headers && \
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python && \
apk del curl
# Install and configure virtualenv
RUN pip install virtualenv==16.3.*
ENV VIRTUAL_ENV=/app/.virtualenv
ENV PATH=$VIRTUAL_ENV/bin:/root/.poetry/bin:$PATH
# Initialize app dir and entrypoint scripts
RUN mkdir /app
WORKDIR /app
ENV XDG_CONFIG_HOME /app/.config
COPY compose/image /
RUN chmod +x /*.sh
ENTRYPOINT ["/entrypoint.sh"]
## Image with system dependencies for building ##
## =========================================== ##
FROM base AS build
# Essential packages for building python packages
RUN apk add --no-cache build-base git libffi-dev openssl-dev su-exec
## Image with additional dependencies for local docker usage ##
## ========================================================= ##
FROM build as local
RUN chmod -R 777 /root/ ## Grant all local users access to poetry
## Image with dev-dependencies ##
## =========================== ##
FROM build AS test
COPY . /app/
RUN \[ -d "$VIRTUAL_ENV" \] || virtualenv "$VIRTUAL_ENV"
RUN . "$VIRTUAL_ENV/bin/activate" && poetry install