From 7dd10c28be667279f68c4083e6e9595067af0b2f Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Sun, 22 Apr 2018 23:28:14 +1200 Subject: [PATCH] Dockerfile copy instead of git clone --- .dockerignore | 45 ++++++++++++++++++++++++++++++++++++++++++++ docker/.dockerignore | 2 -- docker/Dockerfile | 11 +++++------ docker/hooks/build | 2 +- 4 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 .dockerignore delete mode 100644 docker/.dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8f004c6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,45 @@ +# User-specific stuff: +.idea + +## File-based project format: +*.iws + +# IntelliJ +/out/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class +*.pyc + +# logs +*.log* + +# databases +*.db + +# configs +*.cfg +*.json + +# generators +*.bat + +# Pyenv +**/.python-version + +# PyInstaller +build/ +dist/ +*.manifest +*.spec + +# Git +.git + +# Systemd +systemd + +# Docker files +docker diff --git a/docker/.dockerignore b/docker/.dockerignore deleted file mode 100644 index bfefeee..0000000 --- a/docker/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -# Hooks -hooks diff --git a/docker/Dockerfile b/docker/Dockerfile index 2bc7543..44f8bec 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,21 +1,20 @@ FROM python:3.6-alpine3.7 -# Default branch to master -ARG BRANCH=master +# Arguments for build tracking +ARG BRANCH= +ARG COMMIT= ENV \ APP_DIR=traktarr \ BRANCH=${BRANCH} \ + COMMIT=${COMMIT} \ TRAKTARR_CONFIG=/config/config.json \ TRAKTARR_LOGFILE=/config/traktarr.log RUN \ + echo "** BRANCH: ${BRANCH} COMMIT: ${COMMIT} **" && \ echo "** Upgrade all packages **" && \ apk --no-cache -U upgrade && \ - echo "** Install OS dependencies **" && \ - apk --no-cache -U add git && \ - echo "** Get Traktarr branch: ${BRANCH} **" && \ - git clone --depth 1 --branch ${BRANCH} https://github.com/l3uddz/traktarr.git /${APP_DIR} && \ echo "** Install PIP dependencies **" && \ pip install --no-cache-dir --upgrade pip setuptools && \ pip install --no-cache-dir --upgrade -r /${APP_DIR}/requirements.txt diff --git a/docker/hooks/build b/docker/hooks/build index a6ef3df..578d0bd 100644 --- a/docker/hooks/build +++ b/docker/hooks/build @@ -1,3 +1,3 @@ #!/bin/bash -docker build --build-arg BRANCH=${SOURCE_BRANCH} -f ${DOCKERFILE_PATH} -t ${IMAGE_NAME} . +docker build --build-arg BRANCH=${SOURCE_BRANCH} --build-arg COMMIT=${SOURCE_COMMIT} -f ${DOCKERFILE_PATH} -t ${IMAGE_NAME} .