Add simple Docker image and Docker release job on CI

This commit is contained in:
timvisee 2019-03-13 18:41:36 +01:00
parent 2921f6463d
commit 5de3f89de7
No known key found for this signature in database
GPG key ID: B8DB720BC383E172
2 changed files with 37 additions and 0 deletions

View file

@ -212,6 +212,36 @@ release-github:
- ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --file ./ffsend-x86_64-unknown-linux-gnu --name ffsend-$CI_COMMIT_REF_NAME-linux-x64
- ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --file ./ffsend-x86_64-unknown-linux-musl --name ffsend-$CI_COMMIT_REF_NAME-linux-x64-static
# Publish a Docker image
release-docker:
image: docker:git
stage: release
only:
- /^v(\d+\.)*\d+$/
dependencies:
- build-x86_64-linux-musl
variables:
RUST_TARGET: x86_64-unknown-linux-musl
before_script: []
script:
# Place binary in Docker directory, change to it
- mv ./ffsend-$RUST_TARGET ./pkg/docker/ffsend
- cd ./pkg/docker
# Build the Docker image, run it once to test
- docker build -t timvisee/ffsend:latest ./
- docker run --rm -it timvisee/ffsend:latest
# Retag version
- VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
- echo "Determined Docker image version number 'v$VERSION', retagging image..."
- docker tag timvisee/ffsend:latest timvisee/ffsend:$VERSION
# Authenticate and push the Docker images
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin
- docker push timvisee/ffsend:$VERSION
- docker push timvisee/ffsend:latest
# AUR packages release
package-aur:
image: archlinux/base

7
pkg/docker/Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM alpine:latest
LABEL maintainer="Tim Visée <tim@visee.me>"
COPY ./ffsend /
WORKDIR /
ENTRYPOINT ["/ffsend"]