feat: official Dockerfile (#1619)

Adds a Dockerfile for building with Docker Hub
This commit is contained in:
Rhys Arkins 2018-03-09 14:01:09 +01:00 committed by GitHub
parent 9ff363251f
commit 0bd192feec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 0 deletions

16
docker/Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM node:8.10.0-alpine
LABEL maintainer="Rhys Arkins <rhys@arkins.net>"
LABEL name="renovate"
WORKDIR /src
COPY package.json .
COPY yarn.lock .
RUN yarn install --production && yarn cache clean
COPY lib ./lib
RUN chown -R node:node /src
USER node
ENTRYPOINT ["node", "/src/lib/renovate.js"]
CMD ["--help"]

20
docker/hooks/post_push Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
set -e
SEMVER_REGEX="^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$"
if ! [[ "$CACHE_TAG" =~ $SEMVER_REGEX ]]; then
echo Not a semver tag - skipping
exit
fi
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
# Tag and push image for each additional tag
for tag in {"$major","${major}.${minor}"}; do
echo "Tagging ${DOCKER_REPO}:${tag}"
docker tag $IMAGE_NAME ${DOCKER_REPO}:${tag}
docker push ${DOCKER_REPO}:${tag}
done

5
docker/hooks/readme.md Normal file
View file

@ -0,0 +1,5 @@
# Docker Hub hooks
This directory is required in order to provide a post-push hook to Docker Hub Autobuild.
See https://docs.docker.com/docker-cloud/builds/advanced/#custom-build-phase-hooks for details.