Commit b9358ca 1 parent fd633aa commit b9358ca Copy full SHA for b9358ca
File tree 2 files changed +72
-0
lines changed
2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Publish Docker Image
2
+
3
+ on :
4
+ push :
5
+ branches : [master]
6
+ pull_request :
7
+ branches : [master]
8
+
9
+ env :
10
+ REGISTRY : ghcr.io
11
+ IMAGE_NAME : ${{ github.repository }}
12
+
13
+ jobs :
14
+ build-and-push-image :
15
+ runs-on : ubuntu-latest
16
+ permissions :
17
+ contents : read
18
+ packages : write
19
+
20
+ steps :
21
+ - name : Checkout repository
22
+ uses : actions/checkout@v2
23
+
24
+ - name : Log in to the Container registry
25
+ uses : docker/login-action@v1
26
+ with :
27
+ registry : ghcr.io
28
+ username : ${{ github.actor }}
29
+ password : ${{ secrets.GITHUB_TOKEN }}
30
+
31
+ - name : Extract metadata (tags, labels) for Docker
32
+ id : meta
33
+ uses : docker/metadata-action@v3
34
+ with :
35
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36
+
37
+ - name : Build and push Docker image
38
+ uses : docker/build-push-action@v2
39
+ with :
40
+ context : .
41
+ push : true
42
+ tags : ${{ steps.meta.outputs.tags }}
43
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
1
+ # Use the official Rust image as a parent image
2
+ FROM rust:slim as builder
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /usr/src/s3-server
6
+
7
+ # Copy the Cargo.toml and Cargo.lock files
8
+ COPY Cargo.toml Cargo.lock ./
9
+
10
+ # Copy the source code
11
+ COPY src ./src
12
+
13
+ # Build the application
14
+ RUN cargo build --release --bin s3-server
15
+
16
+ # Use a smaller base image for the final image
17
+ FROM debian:buster-slim
18
+
19
+ # Set the working directory in the container
20
+ WORKDIR /usr/local/bin
21
+
22
+ # Copy the built executable from the builder stage
23
+ COPY --from=builder /usr/src/s3-server/target/release/s3-server .
24
+
25
+ # Expose the port the app runs on
26
+ EXPOSE 8014
27
+
28
+ # Run the binary
29
+ CMD ["./s3-server" ]
You can’t perform that action at this time.
0 commit comments