diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..b084494 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,24 @@ +name: build-and-publish + +on: + push: + branches: + - "main" + - "feat/docker-build" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ vars.DOCKERHUB_USERNAME }}/sso-rs-demo:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7a0faf1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM rust:1.77 as builder +RUN cargo build --release +COPY target/release/sso-rs /sso-rs + +FROM alpine:3.20.3 +COPY --from=builder /sso-rs /sso-rs +EXPOSE 3000 +EXPOSE 2999 +CMD ["/sso-rs"]