ci: Remove superfluous generate-dockerfiles template system.

Dockerfiles already support variables.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-06-24 12:52:53 -07:00 committed by Anders Kaseorg
parent d7df1f208a
commit 16067bc4fc
5 changed files with 23 additions and 73 deletions

View File

@ -21,11 +21,11 @@
# then borrows from the CircleCI Dockerfile.
# To rebuild from this file for a given release, say bionic:
# 1. $ tools/ci/generate-dockerfiles
# 2. $ docker build tools/ci/images/$RELEASE/ --tag zulip/ci:$RELEASE
# 3. $ docker push zulip/ci:$RELEASE
# docker build . --build-arg=BASE_IMAGE=buildpack-deps:bionic-scm --pull --tag=zulip/ci:bionic
# docker push zulip/ci:bionic
FROM {base_image}
ARG BASE_IMAGE
FROM $BASE_IMAGE
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
@ -52,9 +52,9 @@ ENV LC_ALL C.UTF-8
# Docker core...
RUN set -e \
&& export DOCKER_VERSION=$(curl --silent --fail --retry 3 https://download.docker.com/linux/static/stable/x86_64/ | grep -o -e 'docker-[.0-9]*-ce\.tgz' | sort -r | head -n 1) \
&& DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${{DOCKER_VERSION}}" \
&& DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \
&& echo Docker URL: $DOCKER_URL \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${{DOCKER_URL}}" \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \
&& ls -lha /tmp/docker.tgz \
&& tar -xz -C /tmp -f /tmp/docker.tgz \
&& mv /tmp/docker/* /usr/bin \

View File

@ -1,10 +1,10 @@
# To build these production upgrade test images, say a Debian Buster system
# preinstalled with Zulip 3.4 (RELEASE=buster, VERSION=3.4):
# 0. $ tools/ci/generate-dockerfiles # Defined in tools/ci/images.yml
# 1. $ docker build tools/ci/images/$RELEASE-$VERSION/ --tag zulip/ci:$RELEASE-$VERSION
# 2. $ docker push zulip/ci:$RELEASE-$VERSION
# preinstalled with Zulip 3.4:
# docker build . -f Dockerfile.prod --build-arg=BASE_IMAGE=zulip/ci:buster --build-arg=VERSION=3.4 --tag=zulip/ci:buster-3.4
# docker push zulip/ci:buster-3.4
FROM {base_image}
ARG BASE_IMAGE
FROM $BASE_IMAGE
# Remove already existing rabbitmq mnesia directory files
RUN sudo rm -rf /var/lib/rabbitmq/mnesia/*
@ -15,11 +15,12 @@ RUN if (. /etc/os-release && [ "$ID $VERSION_ID" = 'ubuntu 18.04' ]); then \
fi
# Download the release tarball, start rabbitmq server and install the server
ARG VERSION
RUN cd $(mktemp -d) \
&& wget https://www.zulip.org/dist/releases/zulip-server-{version}.tar.gz \
&& tar -xf zulip-server-{version}.tar.gz \
&& wget "https://www.zulip.org/dist/releases/zulip-server-$VERSION.tar.gz" \
&& tar -xf "zulip-server-$VERSION.tar.gz" \
&& sudo service rabbitmq-server start \
&& sudo service rabbitmq-server status \
&& sudo -s ./zulip-server-{version}/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com
&& sudo -s "./zulip-server-$VERSION/scripts/setup/install" --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com
CMD ["/bin/sh"]

8
tools/ci/build-docker-images Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -eux
cd "$(dirname "${BASH_SOURCE[0]}")"
docker build . --build-arg=BASE_IMAGE=buildpack-deps:bionic-scm --pull --tag=zulip/ci:bionic
docker build . --build-arg=BASE_IMAGE=buildpack-deps:focal-scm --pull --tag=zulip/ci:focal
docker build . --build-arg=BASE_IMAGE=buildpack-deps:buster-scm --pull --tag=zulip/ci:buster
docker build . --build-arg=BASE_IMAGE=buildpack-deps:bullseye-scm --pull --tag=zulip/ci:bullseye
docker build . -f Dockerfile.prod --build-arg=BASE_IMAGE=zulip/ci:buster --build-arg=VERSION=3.4 --tag=zulip/ci:buster-3.4

View File

@ -1,43 +0,0 @@
#!/usr/bin/env python3
import os
import yaml
if __name__ == "__main__":
os.chdir(os.path.abspath(os.path.dirname(__file__)))
with open("Dockerfile.template") as f:
docker_template = f.read()
with open("Dockerfile.prod.template") as p:
docker_prod_template = p.read()
with open("images.yml") as f:
dockerfile_settings = yaml.safe_load(f)
for distro in dockerfile_settings["distros"]:
dockerfile_path = f"images/{distro}/Dockerfile"
os.makedirs(os.path.dirname(dockerfile_path), exist_ok=True)
with open(dockerfile_path, "w") as f:
f.write(
"""\
# THIS IS A GENERATED FILE. DO NOT EDIT.
# See template: tools/ci/Dockerfile.template
"""
)
f.write(docker_template.format_map(dockerfile_settings["distros"][distro]))
for server in dockerfile_settings["servers"]:
dockerfile_path = f"images/{server}/Dockerfile"
os.makedirs(os.path.dirname(dockerfile_path), exist_ok=True)
with open(dockerfile_path, "w") as f:
f.write(
"""\
# THIS IS A GENERATED FILE. DO NOT EDIT.
# See template: tools/ci/Dockerfile.prod.template
"""
)
f.write(docker_prod_template.format_map(dockerfile_settings["servers"][server]))

View File

@ -1,16 +0,0 @@
distros:
bionic:
base_image: buildpack-deps:bionic-scm
focal:
base_image: buildpack-deps:focal-scm
buster:
base_image: buildpack-deps:buster-scm
bullseye:
base_image: buildpack-deps:bullseye-scm
servers:
buster-3.4:
base_image: zulip/ci:buster
version: 3.4