From 2dab900fdc4e950a846a118258aea7709db981fd Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 16 Jan 2020 15:09:47 +0100 Subject: [PATCH] debuild & reprepro fixes --- README.md | 27 +++++++++++++++++++++++++++ debuild/Dockerfile | 26 ++++++++++++++++++++++++++ debuild/vn-debuild | 12 ++++++++++++ debuild/vn-include | 32 ++++++++++++++++++++++++++++++++ reprepro/Dockerfile | 7 +++++++ reprepro/apache.conf | 8 ++++++++ 6 files changed, 112 insertions(+) create mode 100644 debuild/Dockerfile create mode 100755 debuild/vn-debuild create mode 100755 debuild/vn-include create mode 100644 reprepro/Dockerfile create mode 100644 reprepro/apache.conf diff --git a/README.md b/README.md index 7e5c551..9960515 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ # Docker Dockerfile and compose files used as basis for service deployment. + +## Build and push an image + +Move to desired folder +``` +$ cd [folder] +``` + +Build the image. +``` +$ docker build -t [registryUrl]/[imageName]:[tag] . +``` + +Login into docker registry. +``` +$ docker login [registryUrl] +``` + +Push the image. +``` +$ docker push [registryUrl]/[imageName]:[tag] +``` + +Logout from docker registry. +``` +$ docker logout [registryUrl] +``` diff --git a/debuild/Dockerfile b/debuild/Dockerfile new file mode 100644 index 0000000..33efab3 --- /dev/null +++ b/debuild/Dockerfile @@ -0,0 +1,26 @@ +FROM debian:buster-slim + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y \ + build-essential \ + debhelper \ + devscripts \ + reprepro \ + && mkdir /build /reprepro + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + ca-certificates \ + gnupg2 \ + libfontconfig \ + && curl -sL https://deb.nodesource.com/setup_10.x | bash - \ + && apt-get install -y --no-install-recommends \ + nodejs + +VOLUME ["/build", "/reprepro"] +WORKDIR /build + +COPY vn-debuild vn-include /usr/bin/ diff --git a/debuild/vn-debuild b/debuild/vn-debuild new file mode 100755 index 0000000..edb83d3 --- /dev/null +++ b/debuild/vn-debuild @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +srcDir=$1 + +if [ ! -f "$srcDir/debian/changelog" ]; then + echo "Invalid source directory." + exit 1 +fi + +echo "Building Debian packages." +(cd "$srcDir" && debuild -uc -us -b) diff --git a/debuild/vn-include b/debuild/vn-include new file mode 100755 index 0000000..c31ae25 --- /dev/null +++ b/debuild/vn-include @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +srcDir=$1 + +if [ ! -f "$srcDir/debian/changelog" ]; then + echo "Invalid source directory." + exit 1 +fi + +codename=$2 +buildDir="$srcDir/.." + +if [ -z "$codename" ]; then + codename="stable" +fi + +cut -d" " -f1 "$srcDir/debian/files" | +while read debFile; do + if [[ ! "$debFile" =~ .*\.deb$ ]]; then + continue + fi + + echo "Adding $debFile" + reprepro -b "/reprepro" includedeb $codename "$buildDir/$debFile" +done + +echo "Cleaning." +(cd "$srcDir" && debian/rules clean) +rm -f $buildDir/*.deb +rm -f $buildDir/*.changes +rm -f $buildDir/*.build diff --git a/reprepro/Dockerfile b/reprepro/Dockerfile new file mode 100644 index 0000000..9d39a9c --- /dev/null +++ b/reprepro/Dockerfile @@ -0,0 +1,7 @@ +FROM php:7.4.1-apache + +RUN apt-get update \ + && apt-get install -y --no-install-recommends reprepro \ + && rm -rf /var/lib/apt/lists/* + +COPY apache.conf /etc/apache2/conf-enabled/reprepro.conf diff --git a/reprepro/apache.conf b/reprepro/apache.conf new file mode 100644 index 0000000..04eb088 --- /dev/null +++ b/reprepro/apache.conf @@ -0,0 +1,8 @@ + + Options Indexes + Options +FollowSymLinks + AllowOverride None + Order Allow,Deny + Allow From All + Require all granted + \ No newline at end of file