Skip to content

Commit 7f09b00

Browse files
authored
Docker (#3)
1 parent ea9410d commit 7f09b00

File tree

5 files changed

+71
-5
lines changed

5 files changed

+71
-5
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.github
2+
.gitignore
3+
README.md
4+
script
5+
target

.github/workflows/docker.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Create and publish a Docker image
2+
on:
3+
push:
4+
branches: ['release']
5+
env:
6+
REGISTRY: ghcr.io
7+
IMAGE_NAME: ${{ github.repository }}
8+
jobs:
9+
build-and-push-image:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
attestations: write
15+
id-token: write
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
- name: Log in to the Container registry
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ${{ env.REGISTRY }}
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
30+
- name: Build and push Docker image
31+
id: push
32+
uses: docker/build-push-action@v6
33+
with:
34+
context: .
35+
push: true
36+
tags: ${{ steps.meta.outputs.tags }}
37+
labels: ${{ steps.meta.outputs.labels }}
38+
- name: Generate artifact attestation
39+
uses: actions/attest-build-provenance@v1
40+
with:
41+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
42+
subject-digest: ${{ steps.push.outputs.digest }}
43+
push-to-registry: true

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ serde = { version = "1.0.210", features = ["derive"] }
2424
serde_with = { version = "3.11.0", features = ["base64"] }
2525
sha2 = "0.10.8"
2626
thiserror = "1.0.64"
27-
tokio = { version = "1.40.0", features = ["signal", "rt-multi-thread"] }
27+
tokio = { version = "1.41.0", features = ["signal", "rt-multi-thread"] }

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM rust:alpine AS build-env
2+
WORKDIR /usr/src/oidcms
3+
COPY . .
4+
RUN apk add --no-cache musl-dev
5+
RUN cargo install --path . --root /usr
6+
7+
FROM gcr.io/distroless/cc-debian12
8+
COPY --from=build-env /usr/bin/oidcms /
9+
10+
ENV EXPIRATION=60
11+
ENV ISSUER="http://rain.okta1.com:1802"
12+
ENV RNG_SEED=0
13+
ENV SECRET="c2VjcmV0"
14+
ENV HOST="0.0.0.0"
15+
ENV PORT=3000
16+
17+
HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://${HOST}:${PORT}/health || exit 1
18+
CMD ["./oidcms"]

0 commit comments

Comments
 (0)