Skip to content

Commit 8aca7ed

Browse files
authored
add dockerfile and docker build workflow support (#5)
1 parent 7a58b23 commit 8aca7ed

3 files changed

Lines changed: 66 additions & 13 deletions

File tree

.github/workflows/docker.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and push docker image
2+
3+
on:
4+
workflow_run:
5+
workflows: [ "Build and Release" ]
6+
types: [ completed ]
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
image_tag: ${{ github.event.workflow_run.head_branch }}
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v2
24+
25+
- name: Log in to Docker Hub
26+
uses: docker/login-action@v3
27+
with:
28+
username: ${{ secrets.DOCKERHUB_USERNAME }}
29+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
30+
31+
- name: Build and push image
32+
uses: docker/build-push-action@v6
33+
with:
34+
context: .
35+
push: true
36+
tags: |
37+
rustfs/rc:${{ env.image_tag }}
38+
rustfs/rc:latest

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM rust:1.92.0-alpine3.23 AS builder
2+
3+
LABEL maintainer="hello@rustfs.com"
4+
5+
WORKDIR /app
6+
7+
COPY . .
8+
9+
RUN cargo build --release
10+
11+
FROM alpine:3.23
12+
13+
COPY --from=builder /app/target/release/rc /usr/bin/rc
14+
COPY --from=builder /app/LICENSE-* /licenses/
15+
16+
ENTRYPOINT ["rc"]

docker/docker-compose.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
services:
88
# RustFS - S3-compatible object storage (Tier 1)
99
rustfs:
10-
image: rustfs/rustfs:latest
11-
container_name: rc-test-rustfs
10+
image: rustfs/rustfs:1.0.0-alpha.80
11+
container_name: rustfs
1212
ports:
1313
- "9000:9000" # S3 API
1414
- "9001:9001" # Console
1515
environment:
16-
RUSTFS_ROOT_USER: accesskey
17-
RUSTFS_ROOT_PASSWORD: secretkey
16+
RUSTFS_ROOT_USER: rustfsadmin
17+
RUSTFS_ROOT_PASSWORD: rustfsadmin
1818
RUSTFS_VOLUMES: /data
1919
RUSTFS_ADDRESS: ":9000"
2020
RUSTFS_CONSOLE_ENABLE: "true"
2121
RUSTFS_CONSOLE_ADDRESS: ":9001"
2222
volumes:
2323
- rustfs-data:/data
2424
healthcheck:
25-
test: ["CMD", "curl", "-sf", "http://localhost:9000/minio/health/live"]
25+
test: ["CMD", "curl", "-sf", "http://127.0.0.1:9000/health"]
2626
interval: 10s
2727
timeout: 5s
2828
retries: 5
@@ -32,18 +32,17 @@ services:
3232

3333
# Initialize RustFS - create test buckets using mc client
3434
rustfs-init:
35-
image: quay.io/minio/mc:latest
36-
container_name: rc-test-rustfs-init
35+
image: rustfs/rc:latest
36+
container_name: rc-init
3737
depends_on:
38-
rustfs:
39-
condition: service_healthy
38+
- rustfs
4039
entrypoint: >
4140
/bin/sh -c "
42-
mc alias set local http://rustfs:9000 accesskey secretkey;
43-
mc mb local/test-bucket --ignore-existing;
44-
mc mb local/another-bucket --ignore-existing;
41+
until (/usr/bin/rc alias set rustfs http://rustfs:9000 rustfsadmin rustfsadmin) do echo '...waiting...' && sleep 1; done;
42+
/usr/bin/rc mb rustfs/test-bucket;
43+
/usr/bin/rc mb rustfs/another-bucket;
4544
echo 'RustFS initialization complete';
46-
exit 0;
45+
tail -f /dev/null
4746
"
4847
networks:
4948
- rc-test-network

0 commit comments

Comments
 (0)