Skip to content

Commit 5086aad

Browse files
darthShadowncw
authored andcommitted
build: disable docker builds on PRs & add missing dockerfile changes
Signed-off-by: Anagh Kumar Baranwal <[email protected]>
1 parent c1b414e commit 5086aad

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

.github/workflows/build_publish_docker_image.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# Github Actions release for rclone
3-
# -*- compile-command: "yamllint -f build_publish_docker_image.yml" -*-
3+
# -*- compile-command: "yamllint -f parsable build_publish_docker_image.yml" -*-
44

55
name: Build & Push Docker Images
66

@@ -11,7 +11,6 @@ on:
1111
- '**'
1212
tags:
1313
- '**'
14-
pull_request:
1514
workflow_dispatch:
1615
inputs:
1716
manual:
@@ -21,7 +20,7 @@ on:
2120

2221
jobs:
2322
build-image:
24-
if: inputs.manual || (github.repository == 'rclone/rclone' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name))
23+
if: inputs.manual || (github.repository == 'rclone/rclone' && github.event_name != 'pull_request')
2524
timeout-minutes: 60
2625
strategy:
2726
fail-fast: false
@@ -192,6 +191,7 @@ jobs:
192191
if-no-files-found: error
193192

194193
merge-image:
194+
name: Merge & Push Final Docker Image
195195
runs-on: ubuntu-24.04
196196
needs:
197197
- build-image

Dockerfile

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,47 @@
11
FROM golang:alpine AS builder
22

3-
COPY . /go/src/github.com/rclone/rclone/
3+
ARG CGO_ENABLED=0
4+
45
WORKDIR /go/src/github.com/rclone/rclone/
56

6-
RUN apk add --no-cache make bash gawk git
7-
RUN \
8-
CGO_ENABLED=0 \
9-
make
10-
RUN ./rclone version
7+
RUN echo "**** Set Go Environment Variables ****" && \
8+
go env -w GOCACHE=/root/.cache/go-build
9+
10+
RUN echo "**** Install Dependencies ****" && \
11+
apk add --no-cache \
12+
make \
13+
bash \
14+
gawk \
15+
git
16+
17+
COPY go.mod .
18+
COPY go.sum .
19+
20+
RUN echo "**** Download Go Dependencies ****" && \
21+
go mod download -x
22+
23+
RUN echo "**** Verify Go Dependencies ****" && \
24+
go mod verify
25+
26+
COPY . .
27+
28+
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
29+
echo "**** Build Binary ****" && \
30+
make
31+
32+
RUN echo "**** Print Version Binary ****" && \
33+
./rclone version
1134

1235
# Begin final image
1336
FROM alpine:latest
1437

15-
RUN apk --no-cache add ca-certificates fuse3 tzdata && \
16-
echo "user_allow_other" >> /etc/fuse.conf
38+
RUN echo "**** Install Dependencies ****" && \
39+
apk add --no-cache \
40+
ca-certificates \
41+
fuse3 \
42+
tzdata && \
43+
echo "Enable user_allow_other in fuse" && \
44+
echo "user_allow_other" >> /etc/fuse.conf
1745

1846
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
1947

0 commit comments

Comments
 (0)