Skip to content

Commit

Permalink
Build master images of slim. (#2845)
Browse files Browse the repository at this point in the history
* Build master images of slim.

* Restore removal

* Slim slim
  • Loading branch information
anuraaga authored Oct 16, 2019
1 parent f14689d commit 25ce143
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 3 deletions.
72 changes: 70 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# the License.
#

#####
# zipkin-builder - An image that caches build repositories (.m2, .npm) to speed up subsequent builds.
#####

FROM openzipkin/zipkin-builder as built

WORKDIR /code
Expand All @@ -21,12 +25,17 @@ COPY . /code/
RUN mvn -B --no-transfer-progress package -DskipTests=true -pl zipkin-server -am

RUN mkdir -p /zipkin && cp zipkin-server/target/zipkin-server-*-exec.jar /zipkin && cd /zipkin && jar xf *.jar && rm *.jar
RUN mkdir -p /zipkin-slim && cp zipkin-server/target/zipkin-server-*-slim.jar /zipkin-slim && cd /zipkin-slim && jar xf *.jar && rm *.jar

FROM maven:3-jdk-11-slim as zipkin-builder

COPY --from=built /root/.m2 /root/.m2
COPY --from=built /root/.npm /root/.npm

#####
# zipkin-ui - An image containing the Zipkin web frontend only, served by NGINX
#####

FROM nginx:1.16-alpine as zipkin-ui
LABEL MAINTAINER Zipkin "https://zipkin.io/"

Expand All @@ -43,6 +52,65 @@ EXPOSE 80

CMD ["/usr/local/bin/nginx.sh"]

#####
# zipkin-slim - An image containing the slim distribution of Zipkin server.
#####

FROM openzipkin/jre-full:11.0.4-11.33 as zipkin-slim
LABEL MAINTAINER Zipkin "https://zipkin.io/"

# Use to set heap, trust store or other system properties.
ENV JAVA_OPTS -Djava.security.egd=file:/dev/./urandom
# 3rd party modules like zipkin-aws will apply profile settings with this
ENV MODULE_OPTS=

RUN adduser -g '' -h /zipkin -D zipkin

# Add environment settings for supported storage types
COPY --from=built --chown=zipkin /zipkin-slim/ /zipkin/
COPY --chown=zipkin docker/zipkin/ /zipkin/
WORKDIR /zipkin

RUN ln -s /busybox/* /bin

USER zipkin

EXPOSE 9410 9411

# This health check was added for Docker Hub automated test service. Parameters
# were changed in order to mark success faster. You may want to change these
# further in production.
#
#
# By default, the Docker health check runs after 30s, and if a failure occurs,
# it waits 30s to try again. This implies a minimum of 30s before the server is
# marked healthy.
#
# https://docs.docker.com/engine/reference/builder/#healthcheck
#
# We expect the server startup to take less than 10 seconds, even in a fresh
# start. Some health checks will trigger a slow "first request" due to schema
# setup (ex this is the case in Elasticsearch and Cassandra). However, we don't
# want to force an initial delay of 30s as defaults would.
#
# Instead, we lower the interval and timeout from 30s to 5s. If a server starts
# in 7s and takes another 2s to install schema, it can still pass in 10s vs 30s.
#
# We retain the 30s even if it would be an excessively long startup. This is to
# accomodate test containers, which can boot slower than production sites, and
# any knock-on effects of that, like slow dependent storage containers which are
# simultaneously bootstrapping. If in production, you have a 30s startup, please
# report to https://gitter.im/openzipkin/zipkin including the values of the
# /health and /info endpoints as this would be unexpected.
#
HEALTHCHECK --interval=5s --start-period=30s --timeout=5s CMD wget --quiet http://localhost:9411/health || exit 1

ENTRYPOINT ["/busybox/sh", "run.sh"]

#####
# zipkin-server - An image containing the full distribution of Zipkin server.
#####

FROM openzipkin/jre-full:11.0.4-11.33 as zipkin-server
LABEL MAINTAINER Zipkin "https://zipkin.io/"

Expand All @@ -51,14 +119,14 @@ ENV JAVA_OPTS -Djava.security.egd=file:/dev/./urandom
# 3rd party modules like zipkin-aws will apply profile settings with this
ENV MODULE_OPTS=

RUN ["/busybox/sh", "-c", "adduser -g '' -h /zipkin -D zipkin"]
RUN adduser -g '' -h /zipkin -D zipkin

# Add environment settings for supported storage types
COPY --from=built --chown=zipkin /zipkin/ /zipkin/
COPY --chown=zipkin docker/zipkin/ /zipkin/
WORKDIR /zipkin

RUN ["/busybox/sh", "-c", "ln -s /busybox/* /bin"]
RUN ln -s /busybox/* /bin

USER zipkin

Expand Down
6 changes: 6 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ like
$ docker build -t openzipkin/zipkin:test -f docker/Dockerfile .
```

If you want the slim distribution instead, run something like

```bash
$ docker build -t openzipkin/zipkin:test -f docker/Dockerfile . --target zipkin-slim
```

## zipkin-ui Docker image

We also provide an image that only contains the static parts of the Zipkin UI served directly with
Expand Down
4 changes: 3 additions & 1 deletion docker/hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ set -v
# to top level.
cd ..

docker build -f $DOCKERFILE_PATH -t $IMAGE_NAME .
docker build -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .
docker build -f "$DOCKERFILE_PATH" -t "${IMAGE_NAME}-slim" . --target zipkin-slim

IFS=',' read -ra TAGS <<< "$DOCKER_TAG"
for tag in ${TAGS[@]}; do
docker tag "$IMAGE_NAME" "${DOCKER_REPO}:${tag}"
docker tag "${IMAGE_NAME}-slim" "${DOCKER_REPO}:${tag}-slim"
done
1 change: 1 addition & 0 deletions docker/hooks/post_push
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if [[ "$DOCKER_REPO" == "index.docker.io/openzipkin/zipkin" ]]; then
IFS=',' read -ra TAGS <<< "$DOCKER_TAG"
for tag in ${TAGS[@]}; do
docker push "openzipkin/zipkin-ui:$tag"
docker push "${DOCKER_REPO}:${tag}-slim"
done

if [[ "$DOCKER_TAG" == "master" ]]; then
Expand Down

0 comments on commit 25ce143

Please sign in to comment.