mirror of https://github.com/ekimekim/wubloader
Add a simple build script to build docker images and a basic dockerfile
parent
71b8f8a1b9
commit
1b21694c27
@ -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
|
@ -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
|
Loading…
Reference in New Issue