Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

Commit 365da62

Browse files
author
Christoph Bühler
committed
chore: add deployment
1 parent f34c543 commit 365da62

File tree

5 files changed

+173
-0
lines changed

5 files changed

+173
-0
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
submodules: true
15+
16+
- name: Login to GitHub Container Registry
17+
uses: docker/login-action@v2
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set up Docker Buildx
24+
id: buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Semantic Release
28+
uses: cycjimmy/semantic-release-action@v2
29+
with:
30+
extra_plugins: |
31+
@codedependant/semantic-release-docker
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/testing.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
lint_and_test:
10+
name: Linting and Testing
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
submodules: true
16+
17+
- run: rustup component add clippy rustfmt
18+
19+
- uses: actions-rs/clippy-check@v1
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
args: --all-features --no-deps
23+
name: Lint Results
24+
25+
- uses: actions-rs/toolchain@v1
26+
with:
27+
toolchain: stable
28+
29+
- uses: actions-rs/cargo@v1
30+
with:
31+
command: fmt
32+
args: --check
33+
34+
- uses: actions-rs/cargo@v1
35+
with:
36+
command: check
37+
38+
- uses: actions-rs/audit-check@v1
39+
with:
40+
token: ${{ secrets.GITHUB_TOKEN }}

.releaserc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
[
7+
"@semantic-release/github",
8+
{
9+
"successComment": false,
10+
"failComment": false
11+
}
12+
],
13+
[
14+
"@codedependant/semantic-release-docker",
15+
{
16+
"dockerImage": "contract-provider",
17+
"dockerRegistry": "ghcr.io",
18+
"dockerProject": "wirepact",
19+
"dockerLogin": false,
20+
"dockerContext": "./",
21+
"dockerFile": "./Dockerfile",
22+
"dockerTags": ["{{major}}.{{minor}}.{{patch}}", "{{major}}.{{minor}}", "{{major}}-latest", "{{git_sha}}", "latest"],
23+
"dockerArgs": {
24+
"BUILD_VERSION": "{{major}}.{{minor}}.{{patch}}",
25+
"COMMIT_SHA": "{{git_sha}}"
26+
}
27+
}
28+
]
29+
]
30+
}

Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM rust:1.62-alpine as build
2+
3+
ARG BUILD_VERSION=0.0.0-development
4+
5+
RUN apk add --update --no-cache openssl-dev musl-dev protoc
6+
RUN rustup component add rustfmt
7+
8+
WORKDIR /app
9+
10+
COPY . .
11+
12+
ENV RUSTFLAGS="-C target-feature=-crt-static"
13+
RUN sed -i -e "s/^version = .*/version = \"${BUILD_VERSION}\"/" Cargo.toml
14+
RUN cargo install --path .
15+
16+
FROM alpine:3.16
17+
18+
ARG BUILD_VERSION=0.0.0-development
19+
ARG COMMIT_SHA=NOT_AVAILABLE
20+
21+
LABEL org.opencontainers.image.authors="cbuehler@rootd.ch" \
22+
org.opencontainers.image.url="https://github.com/WirePact/k8s-contract-provider" \
23+
org.opencontainers.image.documentation="https://github.com/WirePact/k8s-contract-provider/blob/main/README.md" \
24+
org.opencontainers.image.source="https://github.com/WirePact/k8s-contract-provider/blob/main/Dockerfile" \
25+
org.opencontainers.image.version="${BUILD_VERSION}" \
26+
org.opencontainers.image.revision="${COMMIT_SHA}" \
27+
org.opencontainers.image.licenses="Apache-2.0" \
28+
org.opencontainers.image.title="WirePact Contract Provider" \
29+
org.opencontainers.image.description="Module for WirePact that continuously fetches all valid contracts for its own trust zone and stores them in a local file or a Kubernetes secret."
30+
31+
WORKDIR /app
32+
33+
ENV USER=appuser \
34+
UID=1000 \
35+
BUILD_VERSION=${BUILD_VERSION} \
36+
FETCH_INTERVAL=5min
37+
38+
COPY --from=build /usr/local/cargo/bin/k8s-contract-provider /usr/local/bin/k8s-contract-provider
39+
40+
RUN adduser \
41+
--disabled-password \
42+
--gecos "" \
43+
--home "/nonexistent" \
44+
--shell "/sbin/nologin" \
45+
--no-create-home \
46+
--uid "${UID}" \
47+
"${USER}" && \
48+
chown -R appuser:appuser /app && \
49+
chmod +x /usr/local/bin/k8s-contract-provider && \
50+
apk add --update --no-cache libgcc ca-certificates
51+
52+
USER appuser:appuser
53+
54+
ENTRYPOINT ["/usr/local/bin/k8s-contract-provider"]

renovate.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["local>WirePact/renovate-config"],
4+
"git-submodules": {
5+
"enabled": true,
6+
"packageRules": [
7+
{
8+
"matchFiles": [".gitmodules"],
9+
"groupName": "external submodules",
10+
"groupSlug": "submodules",
11+
"semanticCommitType": "chore",
12+
"semanticCommitScope": "submodules"
13+
}
14+
]
15+
}
16+
}

0 commit comments

Comments
 (0)