summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-04 17:23:22 +0000
committerGerrit Code Review <review@openstack.org>2019-02-04 17:23:22 +0000
commitc7472d7f607bb1ee0202cebd9706754f5bb7decf (patch)
treef771f3a6a2071bfd5db8f1c2a6036fc3a926d901
parenta11e962eef5a5aa8f8fc15c4a324dfa6b2465061 (diff)
parent8550346b78778a67d960f9dfe4cc009a748f7710 (diff)
Merge "Switch to ubuntu base image"
-rw-r--r--Makefile13
-rw-r--r--images/airflow/Dockerfile5
-rw-r--r--images/shipyard/Dockerfile72
3 files changed, 63 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 098c9bd..3faa37c 100644
--- a/Makefile
+++ b/Makefile
@@ -31,8 +31,7 @@ PROXY ?= http://proxy.foo.com:8000
31NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local 31NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
32USE_PROXY ?= false 32USE_PROXY ?= false
33 33
34PYTHON_BASE_IMAGE ?= python:3.6 34BASE_IMAGE ?=
35UBUNTU_BASE_IMAGE ?= ubuntu:16.04
36 35
37IMAGE:=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$(IMAGE_NAME):${IMAGE_TAG} 36IMAGE:=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$(IMAGE_NAME):${IMAGE_TAG}
38IMAGE_DIR:=images/$(IMAGE_NAME) 37IMAGE_DIR:=images/$(IMAGE_NAME)
@@ -82,6 +81,8 @@ tests:
82run: 81run:
83 USE_PROXY=$(USE_PROXY) PROXY=$(PROXY) $(SCRIPT) $(IMAGE) 82 USE_PROXY=$(USE_PROXY) PROXY=$(PROXY) $(SCRIPT) $(IMAGE)
84 83
84_BASE_IMAGE_ARG := $(if $(BASE_IMAGE),--build-arg FROM="${BASE_IMAGE}" ,)
85
85.PHONY: build_airflow 86.PHONY: build_airflow
86build_airflow: 87build_airflow:
87ifeq ($(USE_PROXY), true) 88ifeq ($(USE_PROXY), true)
@@ -90,7 +91,7 @@ ifeq ($(USE_PROXY), true)
90 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 91 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
91 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 92 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
92 -f $(IMAGE_DIR)/Dockerfile \ 93 -f $(IMAGE_DIR)/Dockerfile \
93 --build-arg FROM=$(UBUNTU_BASE_IMAGE) \ 94 $(_BASE_IMAGE_ARG) \
94 --build-arg http_proxy=$(PROXY) \ 95 --build-arg http_proxy=$(PROXY) \
95 --build-arg https_proxy=$(PROXY) \ 96 --build-arg https_proxy=$(PROXY) \
96 --build-arg HTTP_PROXY=$(PROXY) \ 97 --build-arg HTTP_PROXY=$(PROXY) \
@@ -104,7 +105,7 @@ else
104 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 105 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
105 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 106 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
106 -f $(IMAGE_DIR)/Dockerfile \ 107 -f $(IMAGE_DIR)/Dockerfile \
107 --build-arg FROM=$(UBUNTU_BASE_IMAGE) \ 108 $(_BASE_IMAGE_ARG) \
108 --build-arg ctx_base=$(BUILD_CTX) . 109 --build-arg ctx_base=$(BUILD_CTX) .
109endif 110endif
110ifeq ($(PUSH_IMAGE), true) 111ifeq ($(PUSH_IMAGE), true)
@@ -119,7 +120,7 @@ ifeq ($(USE_PROXY), true)
119 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 120 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
120 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 121 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
121 -f $(IMAGE_DIR)/Dockerfile \ 122 -f $(IMAGE_DIR)/Dockerfile \
122 --build-arg FROM=$(PYTHON_BASE_IMAGE) \ 123 $(_BASE_IMAGE_ARG) \
123 --build-arg http_proxy=$(PROXY) \ 124 --build-arg http_proxy=$(PROXY) \
124 --build-arg https_proxy=$(PROXY) \ 125 --build-arg https_proxy=$(PROXY) \
125 --build-arg HTTP_PROXY=$(PROXY) \ 126 --build-arg HTTP_PROXY=$(PROXY) \
@@ -133,7 +134,7 @@ else
133 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 134 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
134 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 135 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
135 -f $(IMAGE_DIR)/Dockerfile \ 136 -f $(IMAGE_DIR)/Dockerfile \
136 --build-arg FROM=$(PYTHON_BASE_IMAGE) \ 137 $(_BASE_IMAGE_ARG) \
137 --build-arg ctx_base=$(BUILD_CTX) . 138 --build-arg ctx_base=$(BUILD_CTX) .
138endif 139endif
139ifeq ($(PUSH_IMAGE), true) 140ifeq ($(PUSH_IMAGE), true)
diff --git a/images/airflow/Dockerfile b/images/airflow/Dockerfile
index 6b13096..4656d3f 100644
--- a/images/airflow/Dockerfile
+++ b/images/airflow/Dockerfile
@@ -51,7 +51,6 @@ RUN set -ex && \
51 apt-get -y install \ 51 apt-get -y install \
52 ca-certificates \ 52 ca-certificates \
53 curl \ 53 curl \
54 gcc \
55 git \ 54 git \
56 g++ \ 55 g++ \
57 libffi-dev \ 56 libffi-dev \
@@ -87,7 +86,7 @@ RUN useradd -ms /bin/bash -d ${AIRFLOW_HOME} airflow \
87# Note - removing snakebite (python 2 vs. 3). See: 86# Note - removing snakebite (python 2 vs. 3). See:
88# https://github.com/puckel/docker-airflow/issues/77 87# https://github.com/puckel/docker-airflow/issues/77
89COPY images/airflow/requirements.txt /tmp/ 88COPY images/airflow/requirements.txt /tmp/
90RUN pip3 install -r /tmp/requirements.txt \ 89RUN pip3 install -r /tmp/requirements.txt --no-cache-dir \
91 && pip3 uninstall -y snakebite || true 90 && pip3 uninstall -y snakebite || true
92 91
93# Copy scripts used in the container: 92# Copy scripts used in the container:
@@ -109,7 +108,7 @@ ENV PBR_VERSION 0.1a1
109# stale or out-of-date code between these parts. 108# stale or out-of-date code between these parts.
110# Shipyard requirements, source and installation 109# Shipyard requirements, source and installation
111COPY ${ctx_base}/shipyard_airflow/requirements.txt /tmp/api_requirements.txt 110COPY ${ctx_base}/shipyard_airflow/requirements.txt /tmp/api_requirements.txt
112RUN pip3 install -r /tmp/api_requirements.txt 111RUN pip3 install -r /tmp/api_requirements.txt --no-cache-dir
113 112
114COPY ${ctx_base}/shipyard_airflow /tmp/shipyard/ 113COPY ${ctx_base}/shipyard_airflow /tmp/shipyard/
115RUN cd /tmp/shipyard \ 114RUN cd /tmp/shipyard \
diff --git a/images/shipyard/Dockerfile b/images/shipyard/Dockerfile
index e3bc337..6c0ec77 100644
--- a/images/shipyard/Dockerfile
+++ b/images/shipyard/Dockerfile
@@ -12,7 +12,7 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15ARG FROM=python:3.6 15ARG FROM=ubuntu:16.04
16FROM ${FROM} 16FROM ${FROM}
17 17
18LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' 18LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode'
@@ -26,6 +26,8 @@ ENV container docker
26ENV PORT 9000 26ENV PORT 9000
27ENV LC_ALL C.UTF-8 27ENV LC_ALL C.UTF-8
28ENV LANG C.UTF-8 28ENV LANG C.UTF-8
29# Setting the version explicitly for PBR
30ENV PBR_VERSION 0.1a1
29 31
30ARG DEBIAN_FRONTEND=noninteractive 32ARG DEBIAN_FRONTEND=noninteractive
31ARG ctx_base=src/bin 33ARG ctx_base=src/bin
@@ -33,9 +35,24 @@ ARG ctx_base=src/bin
33# Expose port 9000 for application 35# Expose port 9000 for application
34EXPOSE $PORT 36EXPOSE $PORT
35 37
36# Execute entrypoint 38RUN set -ex && \
37ENTRYPOINT ["/home/shipyard/entrypoint.sh"] 39 apt-get -qq update && \
38CMD ["server"] 40 apt-get -y install \
41 ca-certificates \
42 curl \
43 netbase \
44 python3-dev \
45 python3-setuptools \
46 --no-install-recommends \
47 && apt-get autoremove -yqq --purge \
48 && apt-get clean \
49 && rm -rf \
50 /var/lib/apt/lists/* \
51 /tmp/* \
52 /var/tmp/* \
53 /usr/share/man \
54 /usr/share/doc \
55 /usr/share/doc-base
39 56
40# Create shipyard user 57# Create shipyard user
41RUN useradd -ms /bin/bash shipyard \ 58RUN useradd -ms /bin/bash shipyard \
@@ -48,24 +65,43 @@ COPY ${ctx_base}/shipyard_airflow/entrypoint.sh /home/shipyard/entrypoint.sh
48RUN chown -R shipyard: /home/shipyard \ 65RUN chown -R shipyard: /home/shipyard \
49 && chmod +x /home/shipyard/entrypoint.sh 66 && chmod +x /home/shipyard/entrypoint.sh
50 67
51# Requirements 68# Requirements and Shipyard source
52COPY ${ctx_base}/shipyard_airflow/requirements.txt /home/shipyard/api_requirements.txt 69COPY ${ctx_base}/shipyard_airflow/requirements.txt /home/shipyard/api_requirements.txt
53RUN pip3 install -r /home/shipyard/api_requirements.txt
54
55COPY ${ctx_base}/shipyard_client/requirements.txt /home/shipyard/client_requirements.txt 70COPY ${ctx_base}/shipyard_client/requirements.txt /home/shipyard/client_requirements.txt
56RUN pip3 install -r /home/shipyard/client_requirements.txt
57
58# Setting the version explicitly for PBR
59ENV PBR_VERSION 0.1a1
60
61# Shipyard source and installation
62COPY ${ctx_base}/shipyard_client /home/shipyard/shipyard_client/ 71COPY ${ctx_base}/shipyard_client /home/shipyard/shipyard_client/
63RUN cd /home/shipyard/shipyard_client \
64 && python3 setup.py install
65
66COPY ${ctx_base}/shipyard_airflow /home/shipyard/shipyard/ 72COPY ${ctx_base}/shipyard_airflow /home/shipyard/shipyard/
67RUN cd /home/shipyard/shipyard \
68 && python3 setup.py install
69 73
74# Build
75 RUN set -ex \
76 && buildDeps=' \
77 gcc \
78 git \
79 libssl-dev \
80 make \
81 python3-pip \
82 ' \
83 && apt-get -qq update \
84 && apt-get -y install -y $buildDeps --no-install-recommends \
85 && python3 -m pip install -U pip \
86 && pip3 install -r /home/shipyard/client_requirements.txt --no-cache-dir \
87 && cd /home/shipyard/shipyard_client \
88 && python3 setup.py install \
89 && pip3 install -r /home/shipyard/api_requirements.txt --no-cache-dir \
90 && cd /home/shipyard/shipyard \
91 && python3 setup.py install \
92 && apt-get purge -y --auto-remove $buildDeps \
93 && apt-get autoremove -yqq --purge \
94 && apt-get clean \
95 && rm -rf \
96 /var/lib/apt/lists/* \
97 /tmp/* \
98 /var/tmp/* \
99 /usr/share/man \
100 /usr/share/doc \
101 /usr/share/doc-base
102
103# Entrypoint
104ENTRYPOINT ["/home/shipyard/entrypoint.sh"]
105CMD ["server"]
70# Set user to shipyard 106# Set user to shipyard
71USER shipyard 107USER shipyard