Loading .dockerignore 0 → 100644 +4 −0 Original line number Diff line number Diff line * !/config !/docker-healthcheck !/elastic-entrypoint.sh .gitignore 0 → 100644 +0 −0 Empty file added. .gitlab-ci.yml 0 → 100644 +56 −0 Original line number Diff line number Diff line image: docker:stable stages: - package - test-package docker-build-development: stage: package variables: DOCKER_DRIVER: overlay2 services: - docker:dind only: - branches except: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-latest . - docker push ${CI_REGISTRY_IMAGE} docker-build-stable: stage: package variables: DOCKER_DRIVER: overlay2 services: - docker:dind only: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:latest . - docker push ${CI_REGISTRY_IMAGE} container-scanning: stage: test-package variables: DOCKER_DRIVER: overlay2 allow_failure: true services: - docker:stable-dind only: - branches script: - docker run -d --name db arminc/clair-db:latest - docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1 - apk add -U wget ca-certificates - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker pull ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} - wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 - mv clair-scanner_linux_amd64 clair-scanner - chmod +x clair-scanner - touch clair-whitelist.yml - ./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r gl-sast-container-report.json -l clair.log -w clair-whitelist.yml ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} || true artifacts: paths: [gl-sast-container-report.json] Dockerfile 0 → 100644 +79 −0 Original line number Diff line number Diff line FROM openjdk:8-jre LABEL maintainer "https://github.com/blacktop" # grab gosu for easy step-down from root ENV GOSU_VERSION 1.10 RUN set -x \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true RUN set -ex; \ # https://artifacts.elastic.co/GPG-KEY-elasticsearch key='46095ACC8548582C1A2699A9D27D666CD88E42B4'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/elastic.gpg; \ rm -rf "$GNUPGHOME"; \ apt-key list # https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html # https://www.elastic.co/guide/en/elasticsearch/reference/5.0/deb.html RUN set -x \ && apt-get update && apt-get install -y --no-install-recommends apt-transport-https && rm -rf /var/lib/apt/lists/* \ && echo 'deb https://artifacts.elastic.co/packages/5.x/apt stable main' > /etc/apt/sources.list.d/elasticsearch.list ENV ELASTICSEARCH_VERSION 5.6.4 ENV ELASTICSEARCH_DEB_VERSION 5.6.4 RUN set -x \ \ # don't allow the package to install its sysctl file (causes the install to fail) # Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system && dpkg-divert --rename /usr/lib/sysctl.d/elasticsearch.conf \ \ && apt-get update \ && apt-get install -y --no-install-recommends "elasticsearch=$ELASTICSEARCH_DEB_VERSION" \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH WORKDIR /usr/share/elasticsearch RUN set -ex \ && for path in \ ./data \ ./logs \ ./config \ ./config/scripts \ ./config/ingest-geoip \ ; do \ mkdir -p "$path"; \ chown -R elasticsearch:elasticsearch "$path"; \ done # Install X-Pack plugin RUN elasticsearch-plugin install -b x-pack # Install geoip/user-agent plugin RUN elasticsearch-plugin install -b ingest-geoip RUN elasticsearch-plugin install -b ingest-user-agent COPY config/elastic /usr/share/elasticsearch/config COPY config/x-pack/log4j2.properties /usr/share/elasticsearch/config/x-pack/ COPY config/logrotate /etc/logrotate.d/elasticsearch COPY elastic-entrypoint.sh / COPY docker-healthcheck /usr/local/bin/ VOLUME ["/usr/share/elasticsearch/data"] EXPOSE 9200 9300 ENTRYPOINT ["/elastic-entrypoint.sh"] CMD ["elasticsearch"] # HEALTHCHECK CMD ["docker-healthcheck"] LICENSE 0 → 100644 +21 −0 Original line number Diff line number Diff line The MIT License (MIT) Copyright (c) 2016-2017 blacktop Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Loading
.dockerignore 0 → 100644 +4 −0 Original line number Diff line number Diff line * !/config !/docker-healthcheck !/elastic-entrypoint.sh
.gitlab-ci.yml 0 → 100644 +56 −0 Original line number Diff line number Diff line image: docker:stable stages: - package - test-package docker-build-development: stage: package variables: DOCKER_DRIVER: overlay2 services: - docker:dind only: - branches except: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-latest . - docker push ${CI_REGISTRY_IMAGE} docker-build-stable: stage: package variables: DOCKER_DRIVER: overlay2 services: - docker:dind only: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:latest . - docker push ${CI_REGISTRY_IMAGE} container-scanning: stage: test-package variables: DOCKER_DRIVER: overlay2 allow_failure: true services: - docker:stable-dind only: - branches script: - docker run -d --name db arminc/clair-db:latest - docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1 - apk add -U wget ca-certificates - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker pull ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} - wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 - mv clair-scanner_linux_amd64 clair-scanner - chmod +x clair-scanner - touch clair-whitelist.yml - ./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r gl-sast-container-report.json -l clair.log -w clair-whitelist.yml ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} || true artifacts: paths: [gl-sast-container-report.json]
Dockerfile 0 → 100644 +79 −0 Original line number Diff line number Diff line FROM openjdk:8-jre LABEL maintainer "https://github.com/blacktop" # grab gosu for easy step-down from root ENV GOSU_VERSION 1.10 RUN set -x \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true RUN set -ex; \ # https://artifacts.elastic.co/GPG-KEY-elasticsearch key='46095ACC8548582C1A2699A9D27D666CD88E42B4'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/elastic.gpg; \ rm -rf "$GNUPGHOME"; \ apt-key list # https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html # https://www.elastic.co/guide/en/elasticsearch/reference/5.0/deb.html RUN set -x \ && apt-get update && apt-get install -y --no-install-recommends apt-transport-https && rm -rf /var/lib/apt/lists/* \ && echo 'deb https://artifacts.elastic.co/packages/5.x/apt stable main' > /etc/apt/sources.list.d/elasticsearch.list ENV ELASTICSEARCH_VERSION 5.6.4 ENV ELASTICSEARCH_DEB_VERSION 5.6.4 RUN set -x \ \ # don't allow the package to install its sysctl file (causes the install to fail) # Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system && dpkg-divert --rename /usr/lib/sysctl.d/elasticsearch.conf \ \ && apt-get update \ && apt-get install -y --no-install-recommends "elasticsearch=$ELASTICSEARCH_DEB_VERSION" \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH WORKDIR /usr/share/elasticsearch RUN set -ex \ && for path in \ ./data \ ./logs \ ./config \ ./config/scripts \ ./config/ingest-geoip \ ; do \ mkdir -p "$path"; \ chown -R elasticsearch:elasticsearch "$path"; \ done # Install X-Pack plugin RUN elasticsearch-plugin install -b x-pack # Install geoip/user-agent plugin RUN elasticsearch-plugin install -b ingest-geoip RUN elasticsearch-plugin install -b ingest-user-agent COPY config/elastic /usr/share/elasticsearch/config COPY config/x-pack/log4j2.properties /usr/share/elasticsearch/config/x-pack/ COPY config/logrotate /etc/logrotate.d/elasticsearch COPY elastic-entrypoint.sh / COPY docker-healthcheck /usr/local/bin/ VOLUME ["/usr/share/elasticsearch/data"] EXPOSE 9200 9300 ENTRYPOINT ["/elastic-entrypoint.sh"] CMD ["elasticsearch"] # HEALTHCHECK CMD ["docker-healthcheck"]
LICENSE 0 → 100644 +21 −0 Original line number Diff line number Diff line The MIT License (MIT) Copyright (c) 2016-2017 blacktop Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.