From 357a1929dbcfa89f0f9ccdbba18ae5884182e53a Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Sat, 6 Jun 2020 19:05:16 +0200 Subject: [PATCH] fix: migrate to drone --- .drone.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ .gitattributes | 1 + .travis.yml | 5 ----- LICENSE | 13 +++++++++++++ Makefile | 40 ++++++++++++++++++++++--------------- README.md | 21 ++++++++++++++++---- 6 files changed, 108 insertions(+), 25 deletions(-) create mode 100644 .drone.yml create mode 100644 .gitattributes delete mode 100644 .travis.yml create mode 100644 LICENSE diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..a2b5ba6 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,53 @@ +kind: pipeline +type: docker +name: build-image-x86_64 + +steps: +- name: build-image-latest + image: docker.io/volkerraschek/build-image:latest + commands: + - make container-image/build + volumes: + - name: docker_socket + path: /var/run/docker.sock + when: + branch: + - master + +- name: push-image-latest + image: docker.io/volkerraschek/build-image:latest + commands: + - make container-image/push + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: CONTAINER_IMAGE_REGISTRY_PASSWORD + volumes: + - name: docker_socket + path: /var/run/docker.sock + when: + branch: + - master + event: + - push + +- name: push-image-tagged + image: docker.io/volkerraschek/build-image:latest + commands: + - make container-image/push + environment: + CONTAINER_IMAGE_VERSION: ${DRONE_TAG} + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: CONTAINER_IMAGE_REGISTRY_PASSWORD + volumes: + - name: docker_socket + path: /var/run/docker.sock + when: + branch: + - master + event: + - tag + +volumes: +- name: docker_socket + host: + path: /var/run/docker.sock diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dcd9d00 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +Makefile eol=lf \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d526fab..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -services: -- docker - -script: -- make container-image/push \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5a82408 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2019 Markus Pesch + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/Makefile b/Makefile index 3d00122..8d93620 100644 --- a/Makefile +++ b/Makefile @@ -1,39 +1,47 @@ # CONTAINER_RUNTIME -CONTAINER_RUNTIME:=$(shell which docker) +# The CONTAINER_RUNTIME variable will be used to specified the path to a +# container runtime. This is needed to start and run a container image. +CONTAINER_RUNTIME?=$(shell which docker) # BASE_IMAGE -# Definition of the base container image for flucky -BASE_IMAGE_REGISTRY:=docker.io +# Defines the name of the container base image on which should be built the new +# CONTAINER_IMAGE. +BASE_IMAGE_REGISTRY_NAME:=docker.io BASE_IMAGE_NAMESPACE:=library BASE_IMAGE_NAME:=alpine BASE_IMAGE_VERSION:=3.11.2 -BASE_IMAGE_FULL=${BASE_IMAGE_REGISTRY}/${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_IMAGE_VERSION} +BASE_IMAGE_FULL=${BASE_IMAGE_REGISTRY_NAME}/${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_IMAGE_VERSION} BASE_IMAGE_SHORT=${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_IMAGE_VERSION} -CONTAINER_IMAGE_REGISTRY:=docker.io +# CONTAINER_IMAGE_REGISTRY_NAME +# Defines the name of the new container to be built using several variables. +CONTAINER_IMAGE_REGISTRY_NAME:=docker.io CONTAINER_IMAGE_REGISTRY_USER:=volkerraschek -CONTAINER_IMAGE_NAMESPACE:=volkerraschek -CONTAINER_IMAGE_NAME:=network-tools -CONTAINER_IMAGE_VERSION?=latest -CONTAINER_IMAGE_SHORT:=${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION} -CONTAINER_IMAGE_FULL:=${CONTAINER_IMAGE_REGISTRY}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION} -# DEBIAN BASED CONTAINER IMAGE +CONTAINER_IMAGE_NAMESPACE?=${CONTAINER_IMAGE_REGISTRY_USER} +CONTAINER_IMAGE_NAME:=build-image +CONTAINER_IMAGE_VERSION?=latest +CONTAINER_IMAGE_FULL=${CONTAINER_IMAGE_REGISTRY_NAME}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION} +CONTAINER_IMAGE_SHORT=${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION} + +# BUILD CONTAINER IMAGE # ============================================================================== -PHONY+=container-image/build +PHONY:=container-image/build container-image/build: ${CONTAINER_RUNTIME} build \ --build-arg BASE_IMAGE=${BASE_IMAGE_FULL} \ + --file Dockerfile \ --no-cache \ + --pull \ --tag ${CONTAINER_IMAGE_FULL} \ --tag ${CONTAINER_IMAGE_SHORT} \ . +# PUSH CONTAINER IMAGE +# ============================================================================== PHONY+=container-image/push -container-image/push: container-image/build - ${CONTAINER_RUNTIME} login ${CONTAINER_IMAGE_REGISTRY} \ - --username ${CONTAINER_IMAGE_REGISTRY_USER} \ - --password ${CONTAINER_IMAGE_REGISTRY_PASSWORD} +container-image/push: + echo ${CONTAINER_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${CONTAINER_IMAGE_REGISTRY_NAME} --username ${CONTAINER_IMAGE_REGISTRY_USER} --password-stdin ${CONTAINER_RUNTIME} push ${CONTAINER_IMAGE_FULL} # PHONY diff --git a/README.md b/README.md index 9db473e..36ffe87 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,21 @@ # network-tools -[![Build Status](https://travis-ci.com/volker-raschek/network-tools.svg?branch=master)](https://travis-ci.com/volker-raschek/network-tools) +[![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/network-tools/status.svg)](https://drone.cryptic.systems/volker.raschek/network-tools) [![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/network-tools)](https://hub.docker.com/r/volkerraschek/network-tools) -This repository contains only build files for a container image with -network-tools. This can be helpful to analyse in a container environment network -communication. +This project, hosted on +[git.cryptic.systems](https://git.cryptic.systems/volker.raschek/network-tools), +contains only files to build to container image. The container image contains +network tools to analyse or monitor network communication. This can be helpful +in a containerized environment. + +## Usage + +To use this image execute the following command. + +```bash +$ docker run \ + --rm \ + volkerraschek/network-tools:latest \ + bash +``` \ No newline at end of file