mirror of https://github.com/docker/docker-py.git
42 lines
1.4 KiB
Docker
42 lines
1.4 KiB
Docker
ARG PYTHON_VERSION=3.7
|
|
ARG SSH_DIND="ssh-dind:latest"
|
|
FROM ${SSH_DIND} as sshdind
|
|
|
|
FROM python:${PYTHON_VERSION}
|
|
|
|
ARG APT_MIRROR
|
|
RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
|
|
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
|
|
|
|
RUN apt-get update && apt-get -y install \
|
|
gnupg2 \
|
|
pass \
|
|
curl
|
|
|
|
COPY ./tests/gpg-keys /gpg-keys
|
|
RUN gpg2 --import gpg-keys/secret
|
|
RUN gpg2 --import-ownertrust gpg-keys/ownertrust
|
|
RUN yes | pass init $(gpg2 --no-auto-check-trustdb --list-secret-key | awk '/^sec/{getline; $1=$1; print}')
|
|
RUN gpg2 --check-trustdb
|
|
ARG CREDSTORE_VERSION=v0.6.3
|
|
RUN curl -sSL -o /opt/docker-credential-pass.tar.gz \
|
|
https://github.com/docker/docker-credential-helpers/releases/download/$CREDSTORE_VERSION/docker-credential-pass-$CREDSTORE_VERSION-amd64.tar.gz && \
|
|
tar -xf /opt/docker-credential-pass.tar.gz -O > /usr/local/bin/docker-credential-pass && \
|
|
rm -rf /opt/docker-credential-pass.tar.gz && \
|
|
chmod +x /usr/local/bin/docker-credential-pass
|
|
|
|
WORKDIR /src
|
|
COPY requirements.txt /src/requirements.txt
|
|
RUN pip install -r requirements.txt
|
|
|
|
COPY test-requirements.txt /src/test-requirements.txt
|
|
RUN pip install -r test-requirements.txt
|
|
|
|
COPY . /src
|
|
RUN pip install .
|
|
|
|
# Add the keys and set permissions
|
|
COPY --from=sshdind /root/.ssh /root/.ssh
|
|
RUN chmod 600 /root/.ssh/id_rsa && \
|
|
chmod 600 /root/.ssh/id_rsa.pub
|