Skip to content

Commit ef0c8e0

Browse files
author
David McKay
committed
Cleanup Dockerfile's
This commit tries to remove as many redundant layers as possible, while still maintaining readability.
1 parent edd02e4 commit ef0c8e0

File tree

4 files changed

+29
-35
lines changed

4 files changed

+29
-35
lines changed

docker-test/Dockerfile

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
FROM python:3.6-alpine
22

3+
WORKDIR /root
4+
35
ENV OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json"
46
ENV SENDGRID_API_KEY $SENDGRID_API_KEY
57

6-
RUN apk add --no-cache curl
7-
RUN apk add --update bash && rm -rf /var/cache/apk/*
8+
RUN apk add --update --no-cache bash curl
89

9-
# install Prism
10-
WORKDIR /root
10+
# Install Prism
1111
ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh
12-
RUN chmod +x ./install.sh && sync && \
13-
./install.sh && \
14-
rm ./install.sh
15-
16-
# set up default sendgrid env
17-
WORKDIR /root
12+
RUN sync && bash install.sh
1813

14+
# Set up default SendGrid env
1915
RUN mkdir sendgrid-python
2016
COPY entrypoint.sh entrypoint.sh
21-
RUN chmod +x entrypoint.sh
22-
ENTRYPOINT ["./entrypoint.sh"]
17+
18+
ENTRYPOINT ["entrypoint.sh"]
2319
CMD ["--mock"]

docker-test/entrypoint.sh

100644100755
File mode changed.

docker/Dockerfile

+21-23
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM ubuntu:xenial
2+
3+
WORKDIR /root
4+
25
ENV PYTHON_VERSIONS='python2.7 python3.4 python3.5 python3.6' \
3-
OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json"
6+
OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json" \
7+
DEBIAN_FRONTEND=noninteractive
48

5-
# install testing versions of python, including old versions, from deadsnakes
9+
# Install testing versions of python, including old versions, from deadsnakes
610
RUN set -x \
711
&& apt-get update \
812
&& apt-get install -y --no-install-recommends software-properties-common \
@@ -14,35 +18,29 @@ RUN set -x \
1418
&& apt-get purge -y --auto-remove software-properties-common \
1519
&& rm -rf /var/lib/apt/lists/*
1620

17-
WORKDIR /root
18-
19-
# install Prism
21+
# Install Prism
2022
ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh
21-
RUN chmod +x ./install.sh && sync && \
22-
./install.sh && \
23-
rm ./install.sh
23+
RUN sync && bash install.sh
2424

25-
# install pip, tox
25+
# Install pip, tox
2626
ADD https://bootstrap.pypa.io/get-pip.py get-pip.py
27-
RUN python2.7 get-pip.py && \
28-
pip install tox && \
29-
rm get-pip.py
27+
RUN python2.7 get-pip.py && pip install tox
3028

31-
#install pyyaml, six, werkzeug
32-
RUN python3.6 -m pip install pyyaml
33-
RUN python3.6 -m pip install six
34-
RUN Python3.6 -m pip install werkzeug
35-
RUN Python3.6 -m pip install flask
29+
# Install pyyaml, six, werkzeug
30+
RUN python3.6 -m pip install pyyaml six werkzeug flask
3631

37-
# set up default sendgrid env
32+
# Set up default SendGrid env
3833
WORKDIR /root/sources
39-
RUN git clone https://github.com/sendgrid/sendgrid-python.git && \
40-
git clone https://github.com/sendgrid/python-http-client.git
34+
35+
RUN git clone https://github.com/sendgrid/sendgrid-python.git \
36+
&& git clone https://github.com/sendgrid/python-http-client.git
37+
4138
WORKDIR /root
42-
RUN ln -s /root/sources/sendgrid-python/sendgrid && \
43-
ln -s /root/sources/python-http-client/python_http_client
39+
40+
RUN ln -s /root/sources/sendgrid-python/sendgrid \
41+
&& ln -s /root/sources/python-http-client/python_http_client
4442

4543
COPY entrypoint.sh entrypoint.sh
46-
RUN chmod +x entrypoint.sh
44+
4745
ENTRYPOINT ["./entrypoint.sh"]
4846
CMD ["--mock"]

docker/entrypoint.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)