From 1b21694c278cbcef2cb86438f78a72ff5b571826 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sat, 1 Dec 2018 06:42:01 -0800 Subject: [PATCH] Add a simple build script to build docker images and a basic dockerfile --- build | 30 ++++++++++++++++++++++++++++++ downloader/Dockerfile | 15 +++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 build create mode 100644 downloader/Dockerfile diff --git a/build b/build new file mode 100755 index 0000000..d124b29 --- /dev/null +++ b/build @@ -0,0 +1,30 @@ +#!/bin/bash + +set -eu + +# Builds the docker images. +# Usage: ./build {COMPONENTS}, or just ./build to build all. +# The resulting images are named wubloader-COMPONENT. + +# The different images we can build +COMPONENTS=(downloader) + +# The docker image tag, derived from the git commit + whether working tree is clean +TAG=$(git rev-parse --short HEAD) +if [ -n "$(git status --porcelain --untracked-files=no)" ]; then + TAG="$TAG-wip" +fi + +if [ "$#" -gt 0 ]; then + COMPONENTS=("$@") +fi + +for component in "${COMPONENTS[@]}"; do + echo "Building image for $component" + docker build \ + -f "$component/Dockerfile" \ + -t "wubloader-$component:latest" \ + -t "wubloader-$component:$TAG" \ + . + echo "Built image wubloader-$component:$TAG" +done diff --git a/downloader/Dockerfile b/downloader/Dockerfile new file mode 100644 index 0000000..d06b496 --- /dev/null +++ b/downloader/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine:3.7 +RUN apk --update add py2-pip + +# Install common lib first as it changes less +COPY common /tmp/common +RUN pip install /tmp/common && rm -r /tmp/common + +# Install actual application +COPY downloader /tmp/downloader +RUN pip install /tmp/downloader && rm -r /tmp/downloader + +# Add config file last as it changes most +COPY config.yaml /etc/wubloader.yaml + +CMD python2 -m downloader