Skip to content
This repository was archived by the owner on Jun 29, 2020. It is now read-only.

Add alpine-base images #32

Merged
merged 2 commits into from
May 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ language: bash
dist: trusty

env:
- VERSION=9.2 VARIANT=jre7
- VERSION=9.2 VARIANT=jre8
- VERSION=9.3 VARIANT=jre8
- VERSION=9.2-jre7
- VERSION=9.2-jre8
- VERSION=9.3-jre8
- VERSION=9.3-jre8 VARIANT=alpine

install:
- git clone https://github.com/docker-library/official-images.git ~/official-images

before_script:
- env | sort
- cd "$VERSION-$VARIANT"
- image="jetty:$VERSION-$VARIANT"
- cd "${VERSION}${VARIANT:+/$VARIANT}"
- image="jetty:${VERSION}${VARIANT:+-$VARIANT}"

script:
- docker build --pull -t "$image" .
Expand Down
4 changes: 2 additions & 2 deletions 9.2-jre7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ RUN set -xe \
&& mkdir -p "$JETTY_RUN" "$TMPDIR" \
&& chown -R jetty:jetty "$JETTY_RUN" "$TMPDIR" "$JETTY_BASE"

COPY docker-entrypoint.bash /
COPY docker-entrypoint.sh /

EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.bash"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["java","-Djava.io.tmpdir=/tmp/jetty","-jar","/usr/local/jetty/start.jar"]
12 changes: 10 additions & 2 deletions 9.2-jre7/docker-entrypoint.bash → 9.2-jre7/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash
#!/bin/sh

set -e

if [ "$1" = jetty.sh ]; then
if ! command -v bash >/dev/null 2>&1 ; then
cat >&2 <<- 'EOWARN'
********************************************************************
ERROR: bash not found. Use of jetty.sh requires bash.
********************************************************************
EOWARN
exit 1
fi
cat >&2 <<- 'EOWARN'
********************************************************************
WARNING: Use of jetty.sh from this image is deprecated and may
Expand All @@ -14,7 +22,7 @@ if [ "$1" = jetty.sh ]; then
EOWARN
fi

if ! type -- "$1" &>/dev/null; then
if ! command -v -- "$1" >/dev/null 2>&1 ; then
set -- java -jar "-Djava.io.tmpdir=$TMPDIR" "$JETTY_HOME/start.jar" "$@"
fi

Expand Down
4 changes: 2 additions & 2 deletions 9.2-jre8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ RUN set -xe \
&& mkdir -p "$JETTY_RUN" "$TMPDIR" \
&& chown -R jetty:jetty "$JETTY_RUN" "$TMPDIR" "$JETTY_BASE"

COPY docker-entrypoint.bash /
COPY docker-entrypoint.sh /

EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.bash"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["java","-Djava.io.tmpdir=/tmp/jetty","-jar","/usr/local/jetty/start.jar"]
12 changes: 10 additions & 2 deletions 9.2-jre8/docker-entrypoint.bash → 9.2-jre8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash
#!/bin/sh

set -e

if [ "$1" = jetty.sh ]; then
if ! command -v bash >/dev/null 2>&1 ; then
cat >&2 <<- 'EOWARN'
********************************************************************
ERROR: bash not found. Use of jetty.sh requires bash.
********************************************************************
EOWARN
exit 1
fi
cat >&2 <<- 'EOWARN'
********************************************************************
WARNING: Use of jetty.sh from this image is deprecated and may
Expand All @@ -14,7 +22,7 @@ if [ "$1" = jetty.sh ]; then
EOWARN
fi

if ! type -- "$1" &>/dev/null; then
if ! command -v -- "$1" >/dev/null 2>&1 ; then
set -- java -jar "-Djava.io.tmpdir=$TMPDIR" "$JETTY_HOME/start.jar" "$@"
fi

Expand Down
6 changes: 3 additions & 3 deletions 9.3-jre8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV PATH $JETTY_HOME/bin:$PATH
RUN mkdir -p "$JETTY_HOME"
WORKDIR $JETTY_HOME

ENV JETTY_VERSION 9.3.8.v20160314
ENV JETTY_VERSION 9.3.9.v20160517
ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz

# GPG Keys are personal keys of Jetty committers (see https://dev.eclipse.org/mhonarc/lists/jetty-users/msg05220.html)
Expand Down Expand Up @@ -46,8 +46,8 @@ RUN set -xe \
&& mkdir -p "$JETTY_RUN" "$TMPDIR" \
&& chown -R jetty:jetty "$JETTY_RUN" "$TMPDIR" "$JETTY_BASE"

COPY docker-entrypoint.bash /
COPY docker-entrypoint.sh /

EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.bash"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["java","-Djava.io.tmpdir=/tmp/jetty","-jar","/usr/local/jetty/start.jar"]
65 changes: 65 additions & 0 deletions 9.3-jre8/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
FROM java:8-jre-alpine

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN addgroup -S jetty && adduser -D -S -H -G jetty jetty && rm -rf /etc/group- /etc/passwd- /etc/shadow-

ENV JETTY_HOME /usr/local/jetty
ENV PATH $JETTY_HOME/bin:$PATH
RUN mkdir -p "$JETTY_HOME"
WORKDIR $JETTY_HOME

ENV JETTY_BASE /var/lib/jetty
RUN mkdir -p "$JETTY_BASE"

ENV JETTY_VERSION 9.3.9.v20160517
ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz

# GPG Keys are personal keys of Jetty committers (see https://dev.eclipse.org/mhonarc/lists/jetty-users/msg05220.html)
ENV JETTY_GPG_KEYS \
# 1024D/8FB67BAC 2006-12-10 Joakim Erdfelt <[email protected]>
B59B67FD7904984367F931800818D9D68FB67BAC \
# 1024D/D7C58886 2010-03-09 Jesse McConnell (signing key) <[email protected]>
5DE533CB43DAF8BC3E372283E7AE839CD7C58886
RUN set -xe \

# Install required packages for build time. Will be removed when build finishes.
&& apk add --no-cache --virtual .build-deps gnupg coreutils curl \

&& curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \
&& curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \
&& export GNUPGHOME="$(mktemp -d)" \
&& for key in $JETTY_GPG_KEYS; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \
&& gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \
&& rm -r "$GNUPGHOME" \
&& tar -xvzf jetty.tar.gz \
&& mv jetty-distribution-$JETTY_VERSION/* ./ \
&& sed -i '/jetty-logging/d' etc/jetty.conf \
&& rm -fr demo-base javadoc \
&& rm jetty.tar.gz* \
&& rm -fr jetty-distribution-$JETTY_VERSION/ \

# Get the list of modules in the default start.ini and build new base with those modules, then add setuid
&& cd $JETTY_BASE \
&& modules="$(grep -- ^--module= "$JETTY_HOME/start.ini" | cut -d= -f2 | paste -d, -s)" \
&& java -jar "$JETTY_HOME/start.jar" --add-to-startd="$modules,setuid" \

# Remove installed packages and various cleanup
&& apk del .build-deps \
&& rm -fr .build-deps \
&& rm -rf /tmp/hsperfdata_root

WORKDIR $JETTY_BASE

ENV JETTY_RUN /run/jetty
ENV JETTY_STATE $JETTY_RUN/jetty.state
ENV TMPDIR /tmp/jetty
RUN set -xe \
&& mkdir -p "$JETTY_RUN" "$TMPDIR" \
&& chown -R jetty:jetty "$JETTY_RUN" "$TMPDIR" "$JETTY_BASE"

COPY docker-entrypoint.sh /

EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["java","-Djava.io.tmpdir=/tmp/jetty","-jar","/usr/local/jetty/start.jar"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash
#!/bin/sh

set -e

if [ "$1" = jetty.sh ]; then
if ! command -v bash >/dev/null 2>&1 ; then
cat >&2 <<- 'EOWARN'
********************************************************************
ERROR: bash not found. Use of jetty.sh requires bash.
********************************************************************
EOWARN
exit 1
fi
cat >&2 <<- 'EOWARN'
********************************************************************
WARNING: Use of jetty.sh from this image is deprecated and may
Expand All @@ -14,7 +22,7 @@ if [ "$1" = jetty.sh ]; then
EOWARN
fi

if ! type -- "$1" &>/dev/null; then
if ! command -v -- "$1" >/dev/null 2>&1 ; then
set -- java -jar "-Djava.io.tmpdir=$TMPDIR" "$JETTY_HOME/start.jar" "$@"
fi

Expand Down
12 changes: 10 additions & 2 deletions docker-entrypoint.bash → 9.3-jre8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash
#!/bin/sh

set -e

if [ "$1" = jetty.sh ]; then
if ! command -v bash >/dev/null 2>&1 ; then
cat >&2 <<- 'EOWARN'
********************************************************************
ERROR: bash not found. Use of jetty.sh requires bash.
********************************************************************
EOWARN
exit 1
fi
cat >&2 <<- 'EOWARN'
********************************************************************
WARNING: Use of jetty.sh from this image is deprecated and may
Expand All @@ -14,7 +22,7 @@ if [ "$1" = jetty.sh ]; then
EOWARN
fi

if ! type -- "$1" &>/dev/null; then
if ! command -v -- "$1" >/dev/null 2>&1 ; then
set -- java -jar "-Djava.io.tmpdir=$TMPDIR" "$JETTY_HOME/start.jar" "$@"
fi

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
VERSIONS = $(foreach df,$(wildcard */Dockerfile),$(df:%/Dockerfile=%))
VERSIONS = $(foreach df,$(wildcard */alpine/Dockerfile */Dockerfile),$(df:%/Dockerfile=%))

all: build

build: $(VERSIONS)

define jetty-version
$1:
docker build -t jetty:$1 $1
docker build -t jetty:$(shell echo $1 | sed -e 's/\//-/g') $1
endef
$(foreach version,$(VERSIONS),$(eval $(call jetty-version,$(version))))

Expand Down
29 changes: 29 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

set -e

if [ "$1" = jetty.sh ]; then
if ! command -v bash >/dev/null 2>&1 ; then
cat >&2 <<- 'EOWARN'
********************************************************************
ERROR: bash not found. Use of jetty.sh requires bash.
********************************************************************
EOWARN
exit 1
fi
cat >&2 <<- 'EOWARN'
********************************************************************
WARNING: Use of jetty.sh from this image is deprecated and may
be removed at some point in the future.

See the documentation for guidance on extending this image:
https://github.com/docker-library/docs/tree/master/jetty
********************************************************************
EOWARN
fi

if ! command -v -- "$1" >/dev/null 2>&1 ; then
set -- java -jar "-Djava.io.tmpdir=$TMPDIR" "$JETTY_HOME/start.jar" "$@"
fi

exec "$@"
73 changes: 41 additions & 32 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,45 +35,54 @@ outputTag() {
}

for path in "${paths[@]}"; do
echo
for variant in '' alpine; do
echo

commit="$(git log -1 --format='format:%H' -- "$path")"
[ -f "$path${variant:+/$variant}/Dockerfile" ] || continue

suffix="${path#*-}" # "jre7"
commit="$(git log -1 --format='format:%H' -- "$path${variant:+/$variant}")"

version="$(grep -m1 'ENV JETTY_VERSION ' "$path/Dockerfile" | cut -d' ' -f3)"
suffix="${path#*-}" # "jre7"

if [[ "$version" == *.v* ]]; then
# Release version
versionAliases=()
while [[ "$version" == *.* ]]; do
version="${version%.*}"
versionAliases+=("$version")
done
else
# Non-release version
versionAliases=("$version")
fi
version="$(grep -m1 'ENV JETTY_VERSION ' "$path${variant:+/$variant}/Dockerfile" | cut -d' ' -f3)"

if [[ "$version" == *.v* ]]; then
# Release version
versionAliases=()
while [[ "$version" == *.* ]]; do
version="${version%.*}"
versionAliases+=("$version")
done
else
# Non-release version
versionAliases=("$version")
fi

# Output ${versionAliases[@]} without suffixes
# e.g. 9.2.10, 9.2, 9, 9.3-alpine
if [ "$suffix" = "$defaultSuffix" ]; then
for va in "${versionAliases[@]}"; do
outputTag "$va${variant:+-$variant}" "$url" "$commit" "$path${variant:+/$variant}"
done
fi

# Output ${versionAliases[@]} without suffixes
# e.g. 9.2.10, 9.2, 9
if [ "$suffix" = "$defaultSuffix" ]; then
# Output ${versionAliases[@]} with suffixes
# e.g. 9.2.10-jre7, 9.2-jre7, 9-jre7, 9-jre8-alpine
for va in "${versionAliases[@]}"; do
outputTag "$va" "$url" "$commit" "$path"
outputTag "$va-$suffix${variant:+-$variant}" "$url" "$commit" "$path${variant:+/$variant}"
done
fi

# Output ${versionAliases[@]} with suffixes
# e.g. 9.2.10-jre7, 9.2-jre7, 9-jre7
for va in "${versionAliases[@]}"; do
outputTag "$va-$suffix" "$url" "$commit" "$path"
# Output custom aliases
# e.g. latest, jre7, jre8, latest-alpine
if [ ${#aliases[$path]} -gt 0 ]; then
for va in ${aliases[$path]}; do
if [ ! -z "$variant" -a "$va" = 'latest' ]; then
va="$variant"
else
va="$va${variant:+-$variant}"
fi
outputTag "$va" "$url" "$commit" "$path${variant:+/$variant}"
done
fi
done

# Output custom aliases
# e.g. latest, jre7, jre8
if [ ${#aliases[$path]} -gt 0 ]; then
for va in ${aliases[$path]}; do
outputTag "$va" "$url" "$commit" "$path"
done
fi
done
19 changes: 11 additions & 8 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ for path in "${paths[@]}"; do
exit 1
fi

(
set -x
cp docker-entrypoint.bash "$path/"
sed -ri '
s/^(FROM) .*/\1 '"$baseImage"'/;
s/^(ENV JETTY_VERSION) .*/\1 '"$fullVersion"'/;
' "$path/Dockerfile"
)
for variant in alpine ''; do
[ -d "$path/$variant" ] || continue
(
set -x
cp docker-entrypoint.sh "$path/$variant"
sed -ri '
s/^(FROM) .*/\1 '"$baseImage${variant:+-$variant}"'/;
s/^(ENV JETTY_VERSION) .*/\1 '"$fullVersion"'/;
' "$path/$variant/Dockerfile"
)
done
done