Skip to content

Add alpine variants #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 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
25 changes: 16 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,31 @@ language: bash
services: docker

env:
- VERSION=5.0
- VERSION=2.4
- VERSION=2.3
- VERSION=2.2
- VERSION=2.1
- VERSION=2.0
- VERSION=1.5
- VERSION=5.0 VARIANT=
- VERSION=5.0 VARIANT=alpine
- VERSION=2.4 VARIANT=
- VERSION=2.4 VARIANT=alpine
- VERSION=2.3 VARIANT=
- VERSION=2.3 VARIANT=alpine
- VERSION=2.2 VARIANT=
- VERSION=2.2 VARIANT=alpine
- VERSION=2.1 VARIANT=
- VERSION=2.1 VARIANT=alpine
- VERSION=2.0 VARIANT=
- VERSION=2.0 VARIANT=alpine
- VERSION=1.5 VARIANT=
- VERSION=1.5 VARIANT=alpine

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

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

script:
- docker build -t "$image" .
- docker build -t "$image" "${VARIANT:-.}"
- ~/official-images/test/run.sh "$image"

after_script:
Expand Down
5 changes: 3 additions & 2 deletions 1.5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC85485

RUN echo 'deb http://packages.elastic.co/logstash/1.5/debian stable main' > /etc/apt/sources.list.d/logstash.list

ENV LOGSTASH_VERSION 1:1.5.6-1
ENV LOGSTASH_VERSION 1.5.6
ENV LOGSTASH_DEB_VERSION 1:1.5.6-1

RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends logstash=$LOGSTASH_VERSION \
&& apt-get install -y --no-install-recommends "logstash=$LOGSTASH_DEB_VERSION" \
&& rm -rf /var/lib/apt/lists/*

ENV PATH /opt/logstash/bin:$PATH
Expand Down
85 changes: 85 additions & 0 deletions 1.5/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
FROM openjdk:8-jre-alpine

# ensure logstash user exists
RUN addgroup -S logstash && adduser -S -G logstash logstash

# install plugin dependencies
RUN apk add --no-cache \
# env: can't execute 'bash': No such file or directory
bash \
libzmq

# grab su-exec for easy step-down from root
RUN apk add --no-cache 'su-exec>=0.2'

# https://www.elastic.co/guide/en/logstash/5.0/installing-logstash.html#_apt
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4

ENV LOGSTASH_PATH /opt/logstash/bin
ENV PATH $LOGSTASH_PATH:$PATH

ENV LOGSTASH_VERSION 1.5.6
ENV LOGSTASH_TARBALL="https://download.elastic.co/logstash/logstash/logstash-1.5.6.tar.gz" \
LOGSTASH_TARBALL_ASC="" \
LOGSTASH_TARBALL_SHA1="f3e4342f496e0d7e709de231daf624eb1fd80873"

RUN set -ex; \
\
if [ -z "$LOGSTASH_TARBALL_SHA1" ] && [ -z "$LOGSTASH_TARBALL_ASC" ]; then \
echo >&2 'error: have neither a SHA1 _or_ a signature file -- cannot verify download!'; \
exit 1; \
fi; \
\
apk add --no-cache --virtual .fetch-deps \
ca-certificates \
gnupg \
openssl \
tar \
; \
\
wget -O logstash.tar.gz "$LOGSTASH_TARBALL"; \
\
if [ "$LOGSTASH_TARBALL_SHA1" ]; then \
echo "$LOGSTASH_TARBALL_SHA1 *logstash.tar.gz" | sha1sum -c -; \
fi; \
\
if [ "$LOGSTASH_TARBALL_ASC" ]; then \
wget -O logstash.tar.gz.asc "$LOGSTASH_TARBALL_ASC"; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
gpg --batch --verify logstash.tar.gz.asc logstash.tar.gz; \
rm -r "$GNUPGHOME" logstash.tar.gz.asc; \
fi; \
\
dir="$(dirname "$LOGSTASH_PATH")"; \
\
mkdir -p "$dir"; \
tar -xf logstash.tar.gz --strip-components=1 -C "$dir"; \
rm logstash.tar.gz; \
\
apk del .fetch-deps; \
\
export LS_SETTINGS_DIR="$dir/config"; \
# if the "log4j2.properties" file exists (logstash 5.x), let's empty it out so we get the default: "logging only errors to the console"
if [ -f "$LS_SETTINGS_DIR/log4j2.properties" ]; then \
cp "$LS_SETTINGS_DIR/log4j2.properties" "$LS_SETTINGS_DIR/log4j2.properties.dist"; \
truncate -s 0 "$LS_SETTINGS_DIR/log4j2.properties"; \
fi; \
\
# set up some file permissions
for userDir in \
"$dir/config" \
"$dir/data" \
; do \
if [ -d "$userDir" ]; then \
chown -R logstash:logstash "$userDir"; \
fi; \
done; \
\
logstash --version

COPY docker-entrypoint.sh /

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["-e", ""]
15 changes: 15 additions & 0 deletions 1.5/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- logstash "$@"
fi

# Run as user "logstash" if the command is "logstash"
# allow the container to be started with `--user`
if [ "$1" = 'logstash' -a "$(id -u)" = '0' ]; then
set -- su-exec logstash "$@"
fi

exec "$@"
5 changes: 2 additions & 3 deletions 1.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash

set -e

# Add logstash as command if needed
if [ "${1:0:1}" = '-' ]; then
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- logstash "$@"
fi

Expand Down
5 changes: 3 additions & 2 deletions 2.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC85485

RUN echo 'deb http://packages.elastic.co/logstash/2.0/debian stable main' > /etc/apt/sources.list.d/logstash.list

ENV LOGSTASH_VERSION 1:2.0.0-1
ENV LOGSTASH_VERSION 2.0.0
ENV LOGSTASH_DEB_VERSION 1:2.0.0-1

RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends logstash=$LOGSTASH_VERSION \
&& apt-get install -y --no-install-recommends "logstash=$LOGSTASH_DEB_VERSION" \
&& rm -rf /var/lib/apt/lists/*

ENV PATH /opt/logstash/bin:$PATH
Expand Down
85 changes: 85 additions & 0 deletions 2.0/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
FROM openjdk:8-jre-alpine

# ensure logstash user exists
RUN addgroup -S logstash && adduser -S -G logstash logstash

# install plugin dependencies
RUN apk add --no-cache \
# env: can't execute 'bash': No such file or directory
bash \
libzmq

# grab su-exec for easy step-down from root
RUN apk add --no-cache 'su-exec>=0.2'

# https://www.elastic.co/guide/en/logstash/5.0/installing-logstash.html#_apt
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4

ENV LOGSTASH_PATH /opt/logstash/bin
ENV PATH $LOGSTASH_PATH:$PATH

ENV LOGSTASH_VERSION 2.0.0
ENV LOGSTASH_TARBALL="https://download.elastic.co/logstash/logstash/logstash-2.0.0.tar.gz" \
LOGSTASH_TARBALL_ASC="" \
LOGSTASH_TARBALL_SHA1="f0961520dd9590d3b600c877be66f79f94a05f80"

RUN set -ex; \
\
if [ -z "$LOGSTASH_TARBALL_SHA1" ] && [ -z "$LOGSTASH_TARBALL_ASC" ]; then \
echo >&2 'error: have neither a SHA1 _or_ a signature file -- cannot verify download!'; \
exit 1; \
fi; \
\
apk add --no-cache --virtual .fetch-deps \
ca-certificates \
gnupg \
openssl \
tar \
; \
\
wget -O logstash.tar.gz "$LOGSTASH_TARBALL"; \
\
if [ "$LOGSTASH_TARBALL_SHA1" ]; then \
echo "$LOGSTASH_TARBALL_SHA1 *logstash.tar.gz" | sha1sum -c -; \
fi; \
\
if [ "$LOGSTASH_TARBALL_ASC" ]; then \
wget -O logstash.tar.gz.asc "$LOGSTASH_TARBALL_ASC"; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
gpg --batch --verify logstash.tar.gz.asc logstash.tar.gz; \
rm -r "$GNUPGHOME" logstash.tar.gz.asc; \
fi; \
\
dir="$(dirname "$LOGSTASH_PATH")"; \
\
mkdir -p "$dir"; \
tar -xf logstash.tar.gz --strip-components=1 -C "$dir"; \
rm logstash.tar.gz; \
\
apk del .fetch-deps; \
\
export LS_SETTINGS_DIR="$dir/config"; \
# if the "log4j2.properties" file exists (logstash 5.x), let's empty it out so we get the default: "logging only errors to the console"
if [ -f "$LS_SETTINGS_DIR/log4j2.properties" ]; then \
cp "$LS_SETTINGS_DIR/log4j2.properties" "$LS_SETTINGS_DIR/log4j2.properties.dist"; \
truncate -s 0 "$LS_SETTINGS_DIR/log4j2.properties"; \
fi; \
\
# set up some file permissions
for userDir in \
"$dir/config" \
"$dir/data" \
; do \
if [ -d "$userDir" ]; then \
chown -R logstash:logstash "$userDir"; \
fi; \
done; \
\
logstash --version

COPY docker-entrypoint.sh /

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["-e", ""]
15 changes: 15 additions & 0 deletions 2.0/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- logstash "$@"
fi

# Run as user "logstash" if the command is "logstash"
# allow the container to be started with `--user`
if [ "$1" = 'logstash' -a "$(id -u)" = '0' ]; then
set -- su-exec logstash "$@"
fi

exec "$@"
5 changes: 2 additions & 3 deletions 2.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash

set -e

# Add logstash as command if needed
if [ "${1:0:1}" = '-' ]; then
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- logstash "$@"
fi

Expand Down
5 changes: 3 additions & 2 deletions 2.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC85485

RUN echo 'deb http://packages.elastic.co/logstash/2.1/debian stable main' > /etc/apt/sources.list.d/logstash.list

ENV LOGSTASH_VERSION 1:2.1.3-1
ENV LOGSTASH_VERSION 2.1.3
ENV LOGSTASH_DEB_VERSION 1:2.1.3-1

RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends logstash=$LOGSTASH_VERSION \
&& apt-get install -y --no-install-recommends "logstash=$LOGSTASH_DEB_VERSION" \
&& rm -rf /var/lib/apt/lists/*

ENV PATH /opt/logstash/bin:$PATH
Expand Down
85 changes: 85 additions & 0 deletions 2.1/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
FROM openjdk:8-jre-alpine

# ensure logstash user exists
RUN addgroup -S logstash && adduser -S -G logstash logstash

# install plugin dependencies
RUN apk add --no-cache \
# env: can't execute 'bash': No such file or directory
bash \
libzmq

# grab su-exec for easy step-down from root
RUN apk add --no-cache 'su-exec>=0.2'

# https://www.elastic.co/guide/en/logstash/5.0/installing-logstash.html#_apt
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4

ENV LOGSTASH_PATH /opt/logstash/bin
ENV PATH $LOGSTASH_PATH:$PATH

ENV LOGSTASH_VERSION 2.1.3
ENV LOGSTASH_TARBALL="https://download.elastic.co/logstash/logstash/logstash-2.1.3.tar.gz" \
LOGSTASH_TARBALL_ASC="" \
LOGSTASH_TARBALL_SHA1="283f6d8842df52c7d69f77b5c6d4755ee942b291"

RUN set -ex; \
\
if [ -z "$LOGSTASH_TARBALL_SHA1" ] && [ -z "$LOGSTASH_TARBALL_ASC" ]; then \
echo >&2 'error: have neither a SHA1 _or_ a signature file -- cannot verify download!'; \
exit 1; \
fi; \
\
apk add --no-cache --virtual .fetch-deps \
ca-certificates \
gnupg \
openssl \
tar \
; \
\
wget -O logstash.tar.gz "$LOGSTASH_TARBALL"; \
\
if [ "$LOGSTASH_TARBALL_SHA1" ]; then \
echo "$LOGSTASH_TARBALL_SHA1 *logstash.tar.gz" | sha1sum -c -; \
fi; \
\
if [ "$LOGSTASH_TARBALL_ASC" ]; then \
wget -O logstash.tar.gz.asc "$LOGSTASH_TARBALL_ASC"; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
gpg --batch --verify logstash.tar.gz.asc logstash.tar.gz; \
rm -r "$GNUPGHOME" logstash.tar.gz.asc; \
fi; \
\
dir="$(dirname "$LOGSTASH_PATH")"; \
\
mkdir -p "$dir"; \
tar -xf logstash.tar.gz --strip-components=1 -C "$dir"; \
rm logstash.tar.gz; \
\
apk del .fetch-deps; \
\
export LS_SETTINGS_DIR="$dir/config"; \
# if the "log4j2.properties" file exists (logstash 5.x), let's empty it out so we get the default: "logging only errors to the console"
if [ -f "$LS_SETTINGS_DIR/log4j2.properties" ]; then \
cp "$LS_SETTINGS_DIR/log4j2.properties" "$LS_SETTINGS_DIR/log4j2.properties.dist"; \
truncate -s 0 "$LS_SETTINGS_DIR/log4j2.properties"; \
fi; \
\
# set up some file permissions
for userDir in \
"$dir/config" \
"$dir/data" \
; do \
if [ -d "$userDir" ]; then \
chown -R logstash:logstash "$userDir"; \
fi; \
done; \
\
logstash --version

COPY docker-entrypoint.sh /

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["-e", ""]
Loading