← Back to team overview

wordpress-charmers team mailing list archive

[Merge] ~mthaddon/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:docker-fixes into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master

 

Tom Haddon has proposed merging ~mthaddon/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:docker-fixes into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master.

Commit message:
No need to quite docker_deps in Dockerfile

Requested reviews:
  Wordpress Charmers (wordpress-charmers)

For more details, see:
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/wordpress-k8s-image-builder/+merge/382906

No need to quite docker_deps in Dockerfile
-- 
Your team Wordpress Charmers is requested to review the proposed merge of ~mthaddon/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:docker-fixes into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master.
diff --git a/Dockerfile b/Dockerfile
index a482504..2f08cce 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,4 @@
 ARG DIST_RELEASE
-ARG DOCKER_DEPS
 
 FROM ubuntu:${DIST_RELEASE}
 
@@ -8,8 +7,9 @@ LABEL maintainer="wordpress-charmers@xxxxxxxxxxxxxxxxxxx"
 # HTTPS_PROXY used when we RUN curl to download Wordpress itself
 ARG HTTPS_PROXY
 ARG BUILD_DATE
+ARG PKGS_TO_INSTALL
 
-LABEL org.label-schema.build-date=$BUILD_DATE
+LABEL org.label-schema.build-date=${BUILD_DATE}
 
 ENV APACHE_CONFDIR=/etc/apache2
 ENV APACHE_ENVVARS=/etc/apache2/envvars
@@ -20,7 +20,7 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio
 # Update all packages, remove cruft, install required packages, configure apache
 RUN apt-get update && apt-get -y dist-upgrade \
     && apt-get --purge autoremove -y \
-    && apt-get install -y "${DOCKER_DEPS}" \
+    && apt-get install -y ${PKGS_TO_INSTALL} \
     && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
     && . "$APACHE_ENVVARS" \
     && for dir in "$APACHE_LOCK_DIR" "$APACHE_RUN_DIR" "$APACHE_LOG_DIR"; do rm -rvf "$dir"; mkdir -p "$dir"; chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; chmod 777 "$dir";  done \
diff --git a/Makefile b/Makefile
index 077c96f..ab094bf 100644
--- a/Makefile
+++ b/Makefile
@@ -16,18 +16,18 @@ DOCKER_DEPS = \
 	python3-yaml \
 	ssl-cert
 
-build: lint deps
-	@echo "Fetching plugins and themes."
-	@tox -e fetch
+build-image:
 	@echo "Building the image."
 	@docker build \
 		--no-cache=true \
-		--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
-		--build-arg DOCKER_DEPS='$(DOCKER_DEPS)' \
+		--build-arg BUILD_DATE=$$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
+		--build-arg PKGS_TO_INSTALL='$(DOCKER_DEPS)' \
 		--build-arg DIST_RELEASE=$(DIST_RELEASE) \
 		--build-arg HTTPS_PROXY=$(HTTPS_PROXY) \
 		-t wordpress:$(DIST_RELEASE)-latest \
 		.
+
+build: lint deps fetch build-image
 	@echo "Pushing to the prod-is-external registry."
 	@docker tag wordpress:$(DIST_RELEASE)-latest prod-is-external.docker-registry.canonical.com/wordpress:$(DIST_RELEASE)-latest
 	@docker push prod-is-external.docker-registry.canonical.com/wordpress:$(DIST_RELEASE)-latest
@@ -37,6 +37,10 @@ deps:
 	@command -v bzr >/dev/null 2>&1 || { echo "I require bzr but it's not installed. Aborting." >&2; exit 1; }
 	@command -v git >/dev/null 2>&1 || { echo "I require git but it's not installed. Aborting." >&2; exit 1; }
 
+fetch:
+	@echo "Fetching plugins and themes."
+	@tox -e fetch
+
 lint: clean
 	@echo "Running flake8"
 	@tox -e lint

Follow ups