Skip to content

Commit cd7f513

Browse files
committed
add: docker and ci
1 parent b27ef6a commit cd7f513

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: OCI container image for swiftstream
2+
3+
on:
4+
push:
5+
tags: [ 'v*.*.*' ]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Log in to the GHCR
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ${{ env.REGISTRY }}
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Extract metadata (tags, labels) for Docker
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Build and push Docker image
39+
id: push
40+
uses: docker/build-push-action@v6
41+
with:
42+
platforms: linux/amd64,linux/arm64
43+
context: .
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Builder
2+
FROM rust:alpine AS builder
3+
WORKDIR /app
4+
COPY . .
5+
RUN apk add --no-cache --update alpine-sdk openssl-dev openssl-libs-static && \
6+
cargo build --release
7+
8+
# Production
9+
FROM alpine AS prod
10+
11+
COPY --from=builder /app/target/release/swiftstream .
12+
13+
CMD [ "./swiftstream" ]

0 commit comments

Comments
 (0)