fix: migrate to drone

This commit is contained in:
Markus Pesch 2020-06-06 19:05:16 +02:00
parent 1f7eb025be
commit 357a1929db
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
6 changed files with 108 additions and 25 deletions

53
.drone.yml Normal file
View File

@ -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

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
Makefile eol=lf

View File

@ -1,5 +0,0 @@
services:
- docker
script:
- make container-image/push

13
LICENSE Normal file
View File

@ -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.

View File

@ -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

View File

@ -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
```