|
1 | | -ARG PYTHON_VERSION=3.6-stretch |
2 | | -FROM python:${PYTHON_VERSION} |
| 1 | +ARG PYTHON_VERSION=3.6 |
3 | 2 |
|
4 | 3 | ARG GITHUB_ACCOUNT=Wirecloud |
5 | 4 | ARG GITHUB_REPOSITORY=wirecloud |
6 | 5 | ARG SOURCE_BRANCH=develop |
7 | 6 |
|
| 7 | + |
| 8 | + |
| 9 | +FROM python:${PYTHON_VERSION} AS builder |
| 10 | + |
| 11 | +ARG GITHUB_ACCOUNT |
| 12 | +ARG GITHUB_REPOSITORY |
| 13 | +ARG SOURCE_BRANCH |
| 14 | + |
| 15 | +# Build WireCloud wheel |
| 16 | +RUN git clone -b "${SOURCE_BRANCH}" --depth=1 --single-branch https://github.com/"${GITHUB_ACCOUNT}"/"${GITHUB_REPOSITORY}".git && \ |
| 17 | + apt-get update && apt-get install -y gettext && \ |
| 18 | + pip install "django<=2.3" && \ |
| 19 | + cd "${GITHUB_REPOSITORY}"/src && \ |
| 20 | + python setup.py bdist_wheel |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +FROM python:${PYTHON_VERSION}-slim |
| 25 | + |
| 26 | +ARG GITHUB_ACCOUNT |
| 27 | +ARG GITHUB_REPOSITORY |
| 28 | +ARG SOURCE_BRANCH |
| 29 | + |
8 | 30 | # Copying Build time arguments to environment variables so they are persisted at run time and can be |
9 | 31 | # inspected within a running container. |
10 | 32 | # see: https://vsupalov.com/docker-build-time-env-values/ for a deeper explanation. |
11 | 33 |
|
12 | 34 | ENV GITHUB_ACCOUNT=${GITHUB_ACCOUNT} \ |
13 | | - GITHUB_REPOSITORY=${GITHUB_REPOSITORY} |
14 | | - |
15 | | -MAINTAINER WireCloud Team <wirecloud@conwet.com> |
16 | | - |
17 | | -ENV DEFAULT_THEME=wirecloud.defaulttheme \ |
| 35 | + GITHUB_REPOSITORY=${GITHUB_REPOSITORY} \ |
| 36 | + DEFAULT_THEME=wirecloud.defaulttheme \ |
18 | 37 | FORWARDED_ALLOW_IPS=* \ |
19 | 38 | DB_PORT=5432 \ |
20 | 39 | LOGLEVEL=info |
21 | 40 |
|
22 | | -RUN apt-get update && \ |
23 | | - apt-get install -y libmemcached-dev gosu && \ |
24 | | - pip install --no-cache-dir social-auth-app-django "gunicorn==19.3.0" "psycopg2==2.6" pylibmc pysolr "elasticsearch==2.4.1" && \ |
25 | | - rm -rf /var/lib/apt/lists/* && \ |
26 | | - gosu nobody true |
27 | | - |
28 | 41 | # Install WireCloud & dependencies |
29 | | -RUN git clone -b "${SOURCE_BRANCH}" --depth=1 --single-branch https://github.com/"${GITHUB_ACCOUNT}"/"${GITHUB_REPOSITORY}".git && \ |
30 | | - apt-get update && apt-get install -y gettext && \ |
31 | | - pip install "django<=1.11" && \ |
32 | | - cd "${GITHUB_REPOSITORY}"/src && \ |
33 | | - python setup.py bdist_wheel && \ |
34 | | - pip install --no-cache-dir dist/*.whl && \ |
35 | | - cd ../.. && \ |
36 | | - rm -rf "${GITHUB_REPOSITORY}" && \ |
37 | | - apt-get remove -y gettext && \ |
38 | | - rm -rf /var/lib/apt/lists/* |
39 | | - |
| 42 | +COPY --from=builder ${GITHUB_REPOSITORY}/src/dist /dist |
40 | 43 | COPY ./docker-entrypoint.sh / |
41 | 44 | COPY ./manage.py /usr/local/bin/ |
42 | 45 |
|
43 | | -RUN adduser --system --group --shell /bin/bash wirecloud && \ |
44 | | - pip install --no-cache-dir channels asgi_ipc asgi_redis asgi_rabbitmq && \ |
45 | | - pip install wirecloud-keycloak && \ |
| 46 | +RUN apt-get update && \ |
| 47 | + apt-get install -y --no-install-recommends libmemcached-dev gosu gcc ca-certificates curl && \ |
| 48 | + pip install --no-cache-dir social-auth-app-django "gunicorn==19.3.0" psycopg2-binary pylibmc pysolr "elasticsearch==2.4.1" && \ |
| 49 | + pip install --no-cache-dir /dist/*.whl && \ |
| 50 | + rm -rf /dist && \ |
| 51 | + adduser --system --group --shell /bin/bash wirecloud && \ |
| 52 | + pip install --no-cache-dir "channels<2.3" "channels-redis" "channels-rabbitmq" wirecloud-keycloak && \ |
46 | 53 | mkdir -p /opt/wirecloud_instance /var/www/static && \ |
47 | 54 | cd /opt && \ |
48 | 55 | wirecloud-admin startproject wirecloud_instance wirecloud_instance && \ |
49 | 56 | chown -R wirecloud:wirecloud wirecloud_instance /var/www/static && \ |
50 | 57 | chmod a+x wirecloud_instance/manage.py && \ |
51 | | - chmod a+x /docker-entrypoint.sh |
| 58 | + chmod a+x /docker-entrypoint.sh && \ |
| 59 | + apt-get remove -y gcc libmemcached-dev --autoremove && \ |
| 60 | + rm -rf /var/lib/apt/lists/* |
52 | 61 |
|
53 | 62 | COPY ./settings.py ./urls.py /opt/wirecloud_instance/wirecloud_instance/ |
54 | 63 |
|
55 | 64 | WORKDIR /opt/wirecloud_instance |
56 | 65 |
|
57 | | -# volumes must be created after running the collectstatic command |
58 | 66 | VOLUME /var/www/static |
59 | 67 | VOLUME /opt/wirecloud_instance/data |
60 | 68 |
|
|
0 commit comments