File tree 2 files changed +69
-0
lines changed
2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Create and publish a Docker image
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - " *"
7
+
8
+ env :
9
+ REGISTRY : ghcr.io
10
+ IMAGE_NAME : ${{ github.repository }}
11
+
12
+ jobs :
13
+ build-and-push-image :
14
+ runs-on : ubuntu-latest
15
+ permissions :
16
+ contents : read
17
+ packages : write
18
+
19
+ steps :
20
+ - name : Checkout repository
21
+ uses : actions/checkout@v3
22
+ with :
23
+ ref : ${{ github.event.inputs.ref }}
24
+
25
+ - name : Extract metadata (tags, labels) for Docker
26
+ id : meta
27
+ uses : docker/metadata-action@v4
28
+ with :
29
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
30
+
31
+ - name : Set up QEMU
32
+ uses : docker/setup-qemu-action@v2
33
+ with :
34
+ platforms : arm64
35
+
36
+ - name : Set up Docker Buildx
37
+ id : buildx
38
+ uses : docker/setup-buildx-action@v2
39
+
40
+ - name : Log in to the Container registry
41
+ uses : docker/login-action@v2
42
+ with :
43
+ registry : ${{ env.REGISTRY }}
44
+ username : ${{ github.actor }}
45
+ password : ${{ secrets.GITHUB_TOKEN }}
46
+
47
+ - name : Build and push Docker image
48
+ uses : docker/build-push-action@v3
49
+ with :
50
+ context : .
51
+ platforms : linux/amd64, linux/arm64
52
+ push : true
53
+ tags : ${{ steps.meta.outputs.tags }}
54
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
1
+ # syntax=docker/dockerfile:1
2
+
3
+ # Swift official image with arm64 support
4
+ # https://hub.docker.com/r/arm64v8/swift/
5
+ ARG SWIFT_IMAGE=swift:focal
6
+
7
+ FROM $SWIFT_IMAGE AS builder
8
+ COPY . /workspace
9
+ WORKDIR /workspace
10
+ RUN swift build -c release && mv `swift build -c release --show-bin-path`/swiftformat /workspace
11
+
12
+ FROM $SWIFT_IMAGE-slim AS runner
13
+ COPY --from=builder /workspace/swiftformat /usr/bin
14
+ ENTRYPOINT [ "swiftformat" ]
15
+ CMD ["." ]
You can’t perform that action at this time.
0 commit comments