2015-12-17 23:45:51 -05:00
|
|
|
# For running tests, build a docker image with a passwordless sudo and a trust
|
|
|
|
|
# store we can manipulate.
|
|
|
|
|
|
2016-11-10 16:15:17 -05:00
|
|
|
FROM ubuntu:precise
|
2015-12-17 23:45:51 -05:00
|
|
|
|
|
|
|
|
# Add an unprivileged user:
|
|
|
|
|
RUN useradd --create-home --home-dir /home/lea --shell /bin/bash --groups sudo --uid 1000 lea
|
|
|
|
|
|
2017-12-01 13:59:55 -05:00
|
|
|
# Install pip, sudo, and openssl:
|
2016-11-10 16:15:17 -05:00
|
|
|
RUN apt-get update && \
|
|
|
|
|
apt-get -q -y install python-pip sudo openssl && \
|
|
|
|
|
apt-get clean
|
2017-10-31 15:52:40 -04:00
|
|
|
|
2017-12-01 13:59:55 -05:00
|
|
|
# Use pipstrap to update to a stable and tested version of pip
|
|
|
|
|
COPY ./pieces/pipstrap.py /opt
|
|
|
|
|
RUN /opt/pipstrap.py
|
|
|
|
|
# Pin pytest version for increased stability
|
2018-03-29 18:34:38 -04:00
|
|
|
RUN pip install pytest==3.2.5 six==1.10.0
|
2016-11-10 16:15:17 -05:00
|
|
|
|
2015-12-17 23:45:51 -05:00
|
|
|
# Let that user sudo:
|
|
|
|
|
RUN sed -i.bkp -e \
|
|
|
|
|
's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
|
|
|
|
|
/etc/sudoers
|
|
|
|
|
|
2016-04-14 13:50:31 -04:00
|
|
|
RUN mkdir -p /home/lea/certbot
|
2015-12-17 23:45:51 -05:00
|
|
|
|
|
|
|
|
# Install fake testing CA:
|
|
|
|
|
COPY ./tests/certs/ca/my-root-ca.crt.pem /usr/local/share/ca-certificates/
|
|
|
|
|
|
|
|
|
|
# Copy code:
|
2016-04-14 13:50:31 -04:00
|
|
|
COPY . /home/lea/certbot/letsencrypt-auto-source
|
2015-12-17 23:45:51 -05:00
|
|
|
|
|
|
|
|
USER lea
|
|
|
|
|
WORKDIR /home/lea
|
|
|
|
|
|
2017-12-01 13:59:55 -05:00
|
|
|
CMD ["pytest", "-v", "-s", "certbot/letsencrypt-auto-source/tests"]
|