File tree 2 files changed +44
-15
lines changed
2 files changed +44
-15
lines changed Original file line number Diff line number Diff line change
1
+ name : Build + Publish Docker Image 🐳
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ branches :
7
+ - main
8
+
9
+ env :
10
+ IMAGE_NAME : adguardian
11
+ DOCKER_USER : ${{ github.repository_owner }}
12
+ REGISTRY : ghcr.io
13
+
14
+ jobs :
15
+ docker :
16
+ runs-on : ubuntu-latest
17
+
18
+ steps :
19
+ - name : Checkout
20
+ uses : actions/checkout@v2
21
+
22
+ - name : Set up Docker Buildx
23
+ uses : docker/setup-buildx-action@v1
24
+
25
+ - name : Login to GitHub Container Registry
26
+ uses : docker/login-action@v1
27
+ with :
28
+ registry : ${{ env.REGISTRY }}
29
+ username : ${{ github.actor }}
30
+ password : ${{ secrets.GITHUB_TOKEN }}
31
+
32
+ - name : Build and push Docker images
33
+ uses : docker/build-push-action@v2
34
+ with :
35
+ context : .
36
+ file : ./Dockerfile
37
+ push : true
38
+ platforms : linux/amd64,linux/arm64,linux/arm/v7
39
+ tags : |
40
+ ${{ env.REGISTRY }}/${{ env.DOCKER_USER }}/${{ env.IMAGE_NAME }}:latest
Original file line number Diff line number Diff line change 1
1
# syntax=docker/dockerfile:1.2
2
2
3
+ # Build application - Copy assets, install deps and compile binary
3
4
FROM --platform=$BUILDPLATFORM rust:1.69.0-alpine AS builder
4
-
5
- # Adding necessary packages
6
- RUN apk update
7
- RUN apk add pkgconfig openssl openssl-dev musl-dev
8
-
9
- # Set working directory in container; make directory if not exists
10
- RUN mkdir -p /usr/src/adguardian
5
+ RUN apk add --no-cache pkgconfig openssl openssl-dev musl-dev
11
6
WORKDIR /usr/src/adguardian
12
-
13
- # Copy all files from local computer to container
14
- COPY Cargo.toml .
15
- COPY Cargo.lock .
16
- COPY src src
17
-
18
- # Build release application
7
+ COPY . .
19
8
RUN cargo build --release
20
9
21
-
10
+ # Run application - Using lightweight base, execute the binary
22
11
FROM scratch
23
12
COPY --from=builder /usr/src/adguardian/target/release/adguardian /
24
13
ENTRYPOINT ["/adguardian" ]
You can’t perform that action at this time.
0 commit comments