summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-04 16:31:57 +0000
committerGerrit Code Review <review@openstack.org>2019-02-04 16:31:57 +0000
commit4222583a6f754ab415f86421733a7b93f89cddb7 (patch)
treed304c5cccc4076c4bea3403919237dc307d6cf0b
parentd73bd8c3fb92d68a6657ccdd76cab8b5b765642d (diff)
parent259ca27a4f77c19d4253283ebf1d8c3896c8b9e6 (diff)
Merge "Switch to ubuntu base image"
-rw-r--r--Dockerfile72
-rw-r--r--Makefile8
2 files changed, 59 insertions, 21 deletions
diff --git a/Dockerfile b/Dockerfile
index c23e222..65846e3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
1ARG FROM=python:3.6 1ARG FROM=ubuntu:18.04
2FROM ${FROM} 2FROM ${FROM}
3 3
4LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' 4LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode'
@@ -14,31 +14,67 @@ ENV LC_ALL=C.UTF-8
14 14
15EXPOSE 8000 15EXPOSE 8000
16 16
17RUN set -ex && \
18 apt-get -qq update && \
19 apt-get -y install \
20 ca-certificates \
21 curl \
22 netbase \
23 python3-dev \
24 python3-setuptools \
25 --no-install-recommends \
26 && apt-get autoremove -yqq --purge \
27 && apt-get clean \
28 && rm -rf \
29 /var/lib/apt/lists/* \
30 /tmp/* \
31 /var/tmp/* \
32 /usr/share/man \
33 /usr/share/doc \
34 /usr/share/doc-base
35
36WORKDIR /armada
37
38# Add armada user
39RUN useradd -u 1000 -g users -d $(pwd) armada
40
17ENTRYPOINT ["./entrypoint.sh"] 41ENTRYPOINT ["./entrypoint.sh"]
18CMD ["server"] 42CMD ["server"]
19 43
20RUN mkdir -p /armada && \ 44COPY requirements.txt ./
21 apt-get update && \
22 apt-get install -y --no-install-recommends \
23 netbase \
24 curl \
25 git && \
26 useradd -u 1000 -g users -d /armada armada && \
27 rm -rf \
28 /root/.cache \
29 /var/lib/apt/lists/*
30 45
31WORKDIR /armada 46# Build
47RUN set -ex \
48 && buildDeps=' \
49 gcc \
50 libssl-dev \
51 make \
52 python3-pip \
53 ' \
54 && apt-get -qq update \
55 # Keep git separate so it's not removed below
56 && apt-get install -y $buildDeps git --no-install-recommends \
57 && python3 -m pip install -U pip \
58 && pip3 install -r requirements.txt --no-cache-dir \
59 && apt-get purge -y --auto-remove $buildDeps \
60 && apt-get autoremove -yqq --purge \
61 && apt-get clean \
62 && rm -rf \
63 /var/lib/apt/lists/* \
64 /tmp/* \
65 /var/tmp/* \
66 /usr/share/man \
67 /usr/share/doc \
68 /usr/share/doc-base
32 69
33COPY requirements.txt /tmp/ 70COPY . ./
34RUN pip3 install -r /tmp/requirements.txt
35 71
36COPY . /armada 72# Setting the version explicitly for PBR
73ENV PBR_VERSION 0.8.0
37 74
38RUN \ 75RUN \
39 mv /armada/etc/armada /etc/ && \ 76 mv etc/armada /etc/ && \
40 cd /armada && \ 77 chown -R armada:users . && \
41 chown -R armada:users /armada && \
42 python3 setup.py install 78 python3 setup.py install
43 79
44USER armada 80USER armada
diff --git a/Makefile b/Makefile
index 929bde5..1ff8238 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@ COMMIT ?= $(shell git rev-parse HEAD)
29PYTHON = python3 29PYTHON = python3
30CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.)) 30CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.))
31IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} 31IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
32PYTHON_BASE_IMAGE ?= python:3.6 32BASE_IMAGE ?=
33 33
34# VERSION INFO 34# VERSION INFO
35GIT_COMMIT = $(shell git rev-parse HEAD) 35GIT_COMMIT = $(shell git rev-parse HEAD)
@@ -99,6 +99,8 @@ run_images: run_armada
99run_armada: build_armada 99run_armada: build_armada
100 ./tools/armada_image_run.sh $(IMAGE) 100 ./tools/armada_image_run.sh $(IMAGE)
101 101
102_BASE_IMAGE_ARG := $(if $(BASE_IMAGE),--build-arg FROM="${BASE_IMAGE}" ,)
103
102.PHONY: build_armada 104.PHONY: build_armada
103build_armada: 105build_armada:
104ifeq ($(USE_PROXY), true) 106ifeq ($(USE_PROXY), true)
@@ -107,7 +109,7 @@ ifeq ($(USE_PROXY), true)
107 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 109 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
108 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 110 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
109 -f ./Dockerfile \ 111 -f ./Dockerfile \
110 --build-arg FROM=$(PYTHON_BASE_IMAGE) \ 112 $(_BASE_IMAGE_ARG) \
111 --build-arg http_proxy=$(PROXY) \ 113 --build-arg http_proxy=$(PROXY) \
112 --build-arg https_proxy=$(PROXY) \ 114 --build-arg https_proxy=$(PROXY) \
113 --build-arg HTTP_PROXY=$(PROXY) \ 115 --build-arg HTTP_PROXY=$(PROXY) \
@@ -120,7 +122,7 @@ else
120 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 122 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
121 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 123 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
122 -f ./Dockerfile \ 124 -f ./Dockerfile \
123 --build-arg FROM=$(PYTHON_BASE_IMAGE) . 125 $(_BASE_IMAGE_ARG) .
124endif 126endif
125ifeq ($(PUSH_IMAGE), true) 127ifeq ($(PUSH_IMAGE), true)
126 docker push $(IMAGE) 128 docker push $(IMAGE)