commit 1b79ba01adf5276c4192276796358a53c9de4949 Author: James Swineson Date: Fri Apr 17 03:55:57 2020 -0700 first commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..18f1ed3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +FROM debian:10-slim as builder +LABEL image="ripe-atlas-builder" +ARG DEBIAN_FRONTEND=noninteractive +ARG GIT_URL=https://github.com/RIPE-NCC/ripe-atlas-software-probe.git + +RUN apt-get update -y \ + && apt-get install -y git tar fakeroot libssl-dev libcap2-bin autoconf automake libtool build-essential python + +WORKDIR /root + +RUN git clone --recursive "$GIT_URL" + +RUN ./ripe-atlas-software-probe/build-config/debian/bin/make-deb + +FROM debian:10-slim +LABEL maintainer="dockerhub@public.swineson.me" + +ARG DEBIAN_FRONTEND=noninteractive + +COPY --from=builder /root/atlasswprobe-*.deb /tmp + +RUN ln -s /bin/true /bin/systemctl +RUN apt-get update -y \ + && apt-get install -y libcap2-bin iproute2 openssh-client procps net-tools gosu \ + && dpkg -i /tmp/atlasswprobe-*.deb \ + && apt-get install -fy \ + && rm -rf /var/lib/apt/lists/* \ + && rm- rf /tmp/atlasswprobe-*.deb + +RUN ln -s /usr/local/atlas/bin/ATLAS /usr/local/bin/atlas +COPY entrypoint.sh /usr/local/bin + +RUN chmod +x /usr/local/bin/* \ + && groupadd -fr atlas \ + && usermod -aG atlas atlas \ + && chown -R atlas:atlas /var/atlas-probe \ + && mkdir -p /var/atlasdata \ + && chown -R atlas:atlas /var/atlasdata \ + && chmod 777 /var/atlasdata + +WORKDIR /var/atlas-probe +VOLUME [ "/var/atlas-probe/etc", "/var/atlas-probe/status" ] + +ENTRYPOINT [ "entrypoint.sh" ] +CMD [ "atlas" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..e909b7e --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# RIPE Atlas Docker Image + +This is the [RIPE Atlas software probe](https://atlas.ripe.net/docs/software-probe/) packaged as a Docker image. + +## Running + +```shell +docker run \ + --restart=unless-stopped \ + --memory=256m \ + --cap-add=SYS_ADMIN --cap-add=CAP_NET_RAW --cap-add=CAP_CHOWN \ + --mount type=tmpfs,destination=/var/atlasdata \ + --mount type=bind,src=/var/atlas-probe/etc,dst=/var/atlas-probe/etc \ + --mount type=bind,src=/var/atlas-probe/status,dst=/var/atlas-probe/status \ + jamesits/ripe-atlas:latest +``` diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml new file mode 100644 index 0000000..be02757 --- /dev/null +++ b/azure-pipelines.yaml @@ -0,0 +1,79 @@ +name: $(Date:yyyyMMdd).$(Rev:r) +variables: + DOCKER_IMAGE_BASENAME: "jamesits/ripe-atlas" + +trigger: + batch: true + branches: + include: [ "master" ] + paths: + include: [ "*" ] + exclude: [ "README.md" ] + +pr: + autoCancel: true + branches: + include: + - master + paths: + exclude: + - README.md + +schedules: + - cron: "0 3 * * *" + displayName: nightly build + always: true + branches: + include: + - master + +jobs: + - job: docker_nightly + displayName: "docker nightly image build" + pool: + vmImage: "ubuntu-latest" + workspace: + clean: all + timeoutInMinutes: 20 + + steps: + - checkout: self + clean: true + submodules: true + + - bash: | + set -Eeuo pipefail + docker build --rm=false -t ripe-atlas . + docker images --digests ripe-atlas + docker cp $(docker ps -a -f "label=image=ripe-atlas-builder" -f "status=exited" --format "{{.ID}}"):/root ${BUILD_ARTIFACTSTAGINGDIRECTORY} + displayName: "Build image" + + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: 'deb' + parallel: true + parallelCount: 10 + + - task: Docker@1 + displayName: "Docker login" + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'PullRequest')) + inputs: + containerregistrytype: 'Container Registry' + dockerRegistryEndpoint: "Docker Hub: Jamesits" + command: login + + - bash: | + set -Eeuo pipefail + docker tag dst $(DOCKER_IMAGE_BASENAME):nightly + docker push $(DOCKER_IMAGE_BASENAME):nightly + displayName: "Push image" + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'PullRequest')) + + - task: Docker@1 + displayName: "Docker logout" + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'PullRequest')) + inputs: + containerregistrytype: 'Container Registry' + dockerRegistryEndpoint: "Docker Hub: Jamesits" + command: logout diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..3279288 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +chown -R atlas:atlas /var/atlas-probe/status +chown -R atlas:atlas /var/atlas-probe/etc + +exec gosu atlas:atlas "$@"