diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..55b3470 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,22 @@ +--- +name: Pull request +on: + - push + - pull_request +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build + run: make build + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Test + run: make test diff --git a/.gitignore b/.gitignore index 088ba6b..9fc3af8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,12 @@ Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk + +# Editors +*~ +.*.swp +.*sw? + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..36bafbd --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "s3-active-storage" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a72b8df --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 + +# Adapted from the multi-stage build example in https://hub.docker.com/_/rust + +# Stage 1: builder +FROM rust:1.66 as builder +WORKDIR /usr/src/s3-active-storage +COPY . . +RUN cargo install --path . + +# Stage 2: final image +FROM debian:bullseye-slim +COPY --from=builder /usr/local/cargo/bin/s3-active-storage /usr/local/bin/s3-active-storage +CMD ["s3-active-storage"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..84c8b04 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +.PHONY: build +build: + @docker buildx build -t s3-active-storage . + +.PHONY: test +test: + @docker buildx build --target builder -t s3-active-storage-test . + @docker run --rm s3-active-storage-test cargo check --color always + @docker run --rm s3-active-storage-test cargo test --color always + +.PHONY: run +run: + @docker run -it --rm --name s3-active-storage s3-active-storage diff --git a/README.md b/README.md index 0db6b95..36b5e08 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,21 @@ -# rusty-s3-active-storage +# Rusty S3 Active Storage + S3 Active Storage server + +## Build + +```bash +make build +``` + +## Test + +```bash +make test +``` + +## Run + +```bash +make run +``` diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}