Skip to content

Commit

Permalink
Issue #1231: start using smaller build context for otobo.nginx.docker…
Browse files Browse the repository at this point in the history
…file.
  • Loading branch information
bschmalhofer committed Sep 21, 2021
1 parent 4278bdb commit 554a29a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
7 changes: 6 additions & 1 deletion bin/docker/build_docker_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,29 @@ export DOCKER_TAG="local-${otobo_version}"
# build otobo
export DOCKERFILE_PATH=otobo.web.dockerfile
export IMAGE_NAME=otobo:$DOCKER_TAG
export BUILD_PATH=.
hooks/build || exit 1

# build otobo-nginx-webproxy
export DOCKERFILE_PATH=otobo.nginx.dockerfile
export DOCKERFILE_PATH=../../otobo.nginx.dockerfile
export IMAGE_NAME=otobo-nginx-webproxy:$DOCKER_TAG
export BUILD_PATH=scripts/nginx
hooks/build || exit 1

# build otobo-nginx-kerberos-webproxy
export DOCKERFILE_PATH=otobo.nginx-kerberos.dockerfile
export IMAGE_NAME=otobo-nginx-kerberos-webproxy:$DOCKER_TAG
export BUILD_PATH=.
hooks/build || exit 1

# build otobo-elasticsearch
export DOCKERFILE_PATH=otobo.elasticsearch.dockerfile
export IMAGE_NAME=otobo-elasticsearch:$DOCKER_TAG
export BUILD_PATH=.
hooks/build || exit 1

# build otobo-selenium-chrome
export DOCKERFILE_PATH=otobo.selenium-chrome.dockerfile
export IMAGE_NAME=otobo-selenium-chrome:$DOCKER_TAG
export BUILD_PATH=.
hooks/build || exit 1
22 changes: 19 additions & 3 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
#!/bin/sh

# Override the build command for automated builds on Docker Hub.
# Override the build hook of the automated builds on Docker Hub.
# The build hook is running in the root of the git sandbox. That is the directory contaning the file RELEASE.

# See https://docs.docker.com/docker-hub/builds/advanced/ for the list of preset environment variables.
# Additionally, the undocumented environment variable $BUILD_PATH is used. $BUILD_PATH can be set
# in the input field Build Context of the Docker Hub automated build GUI.

# The path to the Dockerfile is given relative to ./$BUILD_PATH in order to be compatible
# with the default build hook in Docker Hub. The default value of the Build Context is '/'. The build command works with this approach,
# because the resulting path will then be something like .//otobo.web.dockerfile.

# These commands can be uncommented for debugging:
#pwd
#ls
#docker -v
#printenv

# build the Docker image
docker build\
--build-arg "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"\
--build-arg "DOCKER_TAG=$DOCKER_TAG"\
--build-arg "GIT_COMMIT=$SOURCE_COMMIT"\
--build-arg "GIT_BRANCH=$SOURCE_BRANCH"\
--build-arg "GIT_REPO=$(git config --get remote.origin.url)"\
-f $DOCKERFILE_PATH\
-f ./$BUILD_PATH/$DOCKERFILE_PATH\
-t $IMAGE_NAME\
.
./$BUILD_PATH
8 changes: 4 additions & 4 deletions otobo.nginx.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is the build file for the OTOBO nginx docker image.
# This is the build file for the OTOBO nginx Docker image.

# See also bin/docker/build_docker_images.sh
# See bin/docker/build_docker_images.sh for how to create local builds.
# See also https://doc.otobo.org/manual/installation/stable/en/content/installation-docker.html

# Use the latest nginx.
Expand Down Expand Up @@ -49,8 +49,8 @@ RUN mv conf.d/default.conf conf.d/default.conf.hidden

# new nginx config, will be modified by /docker-entrypoint.d/20-envsubst-on-templates.sh
# See 'Using environment variables in nginx configuration' in https://hub.docker.com/_/nginx
COPY scripts/nginx/templates/ templates
COPY scripts/nginx/snippets/ snippets
COPY templates/ templates
COPY snippets/ snippets

# Add some additional meta info to the image.
# This done at the end of the Dockerfile as changed labels and changed args invalidate the layer cache.
Expand Down

0 comments on commit 554a29a

Please sign in to comment.