updated Dockerfile to use ARGs
All checks were successful
continuous-integration/drone/push Build is passing

* set LABEL details at build time using ARGs
* added build hook that provides the subject functionality
* refactored Dockerfile
This commit is contained in:
surtur 2020-03-04 20:11:45 +01:00
parent a489fcd203
commit 1fe2e823c4
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 28 additions and 5 deletions

@ -1,2 +1,14 @@
FROM archlinux FROM archlinux/base
RUN pacman -Syu --noconfirm --needed gcc cmake make git valgrind && pacman -Scc && rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/*
ENV container=docker
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-url="https://github.com/wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf/docker-archlinux-cdev.git" \
org.label-schema.vcs-ref=$VCS_REF
RUN pacman -Syu --noconfirm --needed gcc cmake make git valgrind \
&& pacman -Scc \
&& rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/*

@ -1,6 +1,9 @@
# docker-archlinux-cdev [![Build Status](https://drone.dotya.ml/api/badges/wanderer/docker-archlinux-cdev/status.svg?ref=refs/heads/master)](https://drone.dotya.ml/wanderer/docker-archlinux-cdev) # docker-archlinux-cdev
[![Build Status](https://drone.dotya.ml/api/badges/wanderer/docker-archlinux-cdev/status.svg?ref=refs/heads/master)](https://drone.dotya.ml/wanderer/docker-archlinux-cdev)
This repository provides the Dockerfile to create a Docker image used for light C development (some goodies included). This repository provides the Dockerfile to create a Docker image used for light C development (some goodies included).
The image is rebuilt approximately every hour to ensure it always has the latest packages.
## What you get ## What you get
* updated Arch Linux [base image](https://hub.docker.com/_/archlinux) * updated Arch Linux [base image](https://hub.docker.com/_/archlinux)
@ -12,5 +15,3 @@ This repository provides the Dockerfile to create a Docker image used for light
## Purpose ## Purpose
* light C development upon fresh package base * light C development upon fresh package base
Enjoy.

10
hooks/build Normal file

@ -0,0 +1,10 @@
#!/bin/bash
# as per https://github.com/rossf7/label-schema-automated-build
# $IMAGE_NAME var is injected into the build so the tag is correct.
echo "Build hook running"
docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
-t $IMAGE_NAME .