cic-internal-integration/apps/cic-eth/docker/Dockerfile

75 lines
2.5 KiB
Docker
Raw Normal View History

2021-05-25 18:22:26 +02:00
FROM python:3.8.6-slim-buster as compile
2021-02-01 18:12:51 +01:00
2021-05-25 18:22:26 +02:00
WORKDIR /usr/src/cic-eth
2021-02-01 18:12:51 +01:00
2021-05-25 18:22:26 +02:00
RUN apt-get update && \
apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git
2021-02-01 18:12:51 +01:00
2021-05-25 18:22:26 +02:00
#RUN python -m venv venv && . venv/bin/activate
2021-02-01 18:12:51 +01:00
ARG pip_extra_index_url_flag='--index https://pypi.org/simple --extra-index-url https://pip.grassrootseconomics.net:8433'
2021-07-05 22:17:56 +02:00
ARG EXTRA_INDEX_URL="https://pip.grassrootseconomics.net:8433"
2021-07-05 21:26:23 +02:00
ARG GITLAB_PYTHON_REGISTRY="https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple"
2021-05-25 18:22:26 +02:00
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install semver
COPY cic-eth/ .
2021-07-05 21:26:23 +02:00
RUN pip install --extra-index-url $GITLAB_PYTHON_REGISTRY \
--extra-index-url $EXTRA_INDEX_URL .
2021-05-25 18:22:26 +02:00
# --- TEST IMAGE ---
FROM python:3.8.6-slim-buster as test
2021-02-01 18:12:51 +01:00
RUN apt-get update && \
2021-03-01 21:15:17 +01:00
apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git
2021-02-01 18:12:51 +01:00
2021-05-25 18:22:26 +02:00
WORKDIR /usr/src/cic-eth
RUN /usr/local/bin/python -m pip install --upgrade pip
2021-02-01 18:12:51 +01:00
2021-05-25 18:22:26 +02:00
COPY --from=compile /usr/local/bin/ /usr/local/bin/
COPY --from=compile /usr/local/lib/python3.8/site-packages/ \
/usr/local/lib/python3.8/site-packages/
# TODO we could use venv inside container to isolate the system and app deps further
# COPY --from=compile /usr/src/cic-eth/ .
# RUN . venv/bin/activate
ARG ="https://pip.grassrootseconomics.net:8433"
ARG GITLAB_PYTHON_REGISTRY="https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple"
2021-02-01 18:12:51 +01:00
COPY cic-eth/test_requirements.txt .
RUN pip install --extra-index-url $GITLAB_PYTHON_REGISTRY \
--extra-index-url $EXTRA_INDEX_URL .
2021-05-25 18:22:26 +02:00
COPY cic-eth .
ENV PYTHONPATH .
ENTRYPOINT ["pytest"]
# --- RUNTIME ---
FROM python:3.8.6-slim-buster as runtime
RUN apt-get update && \
apt install -y gnupg libpq-dev procps
WORKDIR /usr/src/cic-eth
COPY --from=compile /usr/local/bin/ /usr/local/bin/
COPY --from=compile /usr/local/lib/python3.8/site-packages/ \
/usr/local/lib/python3.8/site-packages/
2021-02-01 18:12:51 +01:00
COPY cic-eth/docker/* ./
RUN chmod 755 *.sh
2021-05-25 18:22:26 +02:00
COPY cic-eth/scripts/ scripts/
2021-02-01 18:12:51 +01:00
# # ini files in config directory defines the configurable parameters for the application
# # they can all be overridden by environment variables
# # to generate a list of environment variables from configuration, use: confini-dump -z <dir> (executable provided by confini package)
COPY cic-eth/config/ /usr/local/etc/cic-eth/
COPY cic-eth/cic_eth/db/migrations/ /usr/local/share/cic-eth/alembic/
COPY cic-eth/crypto_dev_signer_config/ /usr/local/etc/crypto-dev-signer/
2021-02-12 03:27:29 +01:00
COPY util/liveness/health.sh /usr/local/bin/health.sh
2021-05-25 18:22:26 +02:00