Skip to content

Commit 4622535

Browse files
committed
feat: add Docker support with entrypoint script and GitHub Actions workflow
0 parents  commit 4622535

4 files changed

Lines changed: 73 additions & 0 deletions

File tree

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.github
2+
README.md

.github/workflows/main.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
tags:
8+
- '*'
9+
schedule:
10+
- cron: '30 5 * * *'
11+
12+
env:
13+
IMAGE_TAG: ${{ github.event.release.tag_name }}
14+
15+
jobs:
16+
build-and-push-image:
17+
runs-on: ubuntu-latest
18+
steps:
19+
-
20+
name: Checkout
21+
uses: actions/checkout@v3
22+
-
23+
name: Set up QEMU
24+
uses: docker/setup-qemu-action@v2
25+
-
26+
name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
-
29+
name: Docker meta
30+
id: meta
31+
uses: docker/metadata-action@v4
32+
with:
33+
images: skyloud/rclone
34+
-
35+
name: Login to DockerHub
36+
uses: docker/login-action@v2
37+
with:
38+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
39+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
40+
-
41+
name: Build and push
42+
uses: docker/build-push-action@v3
43+
id: docker_build
44+
with:
45+
context: .
46+
platforms: linux/amd64,linux/arm64
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
-
51+
name: Image digest
52+
run: echo ${{ steps.docker_build.outputs.digest }}

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM rclone/rclone:latest
2+
3+
RUN apk add --no-cache curl
4+
5+
COPY --chmod=0755 ./entrypoint.sh /entrypoint.sh
6+
7+
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
rclone "$@"
6+
7+
if [ -z "$HEARTBEAT_URL" ]; then
8+
echo "HEARTBEAT_URL is empty"
9+
exit 1
10+
fi
11+
12+
curl -sSL "$HEARTBEAT_URL"

0 commit comments

Comments
 (0)