소스 검색

Merge branch 'pkg-docker' into 'master'

Create Docker image for easily running ffsend

See merge request timvisee/ffsend!17
Tim Visée 6 년 전
부모
커밋
a6ce935ea4
3개의 변경된 파일60개의 추가작업 그리고 0개의 파일을 삭제
  1. 30 0
      .gitlab-ci.yml
  2. 23 0
      README.md
  3. 7 0
      pkg/docker/Dockerfile

+ 30 - 0
.gitlab-ci.yml

@@ -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

+ 23 - 0
README.md

@@ -280,10 +280,32 @@ move .\ffsend.exe C:\Windows\System32\ffsend.exe
 ```
 
 ### Other OS or architecture
+If your system runs Docker, you can use the [docker image](#docker-image).
 There are currently no other binaries or packages available.
 
 You can [build the project from source](#build) instead.
 
+#### Docker image
+A Docker image is available for using `ffsend` running in a container.
+Mount a directory to `/data`, so it's accessible for `ffsend` in the container,
+and use the command as you normally would.
+
+[» `timvisee/ffsend`][docker-hub-ffsend]
+
+```bash
+# Run container with no parameters
+docker run --rm -it -v $PWD:/data timvisee/ffsend
+
+# Upload a file
+docker run --rm -it -v $PWD:/data timvisee/ffsend upload my-file.txt
+
+# Download a file
+docker run --rm -it -v $PWD:/data timvisee/ffsend download https://send.firefox.com/#sample-share-url
+
+# View help
+docker run --rm -it -v $PWD:/data timvisee/ffsend help
+```
+
 ## Build
 To build and install `ffsend` yourself, you meet the following requirements
 before proceeding:
@@ -537,3 +559,4 @@ Check out the [LICENSE](LICENSE) file for more information.
 [snapcraft-ffsend]: https://snapcraft.io/ffsend
 [homebrew]: https://brew.sh/
 [wsl]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
+[docker-hub-ffsend]: https://hub.docker.com/r/timvisee/ffsend

+ 7 - 0
pkg/docker/Dockerfile

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