-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a1efd9
commit 950c607
Showing
7 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ end_of_line = lf | |
|
||
[*.txt] | ||
insert_final_newline = false | ||
|
||
[*.yml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# | ||
name: Create and publish a Docker image | ||
|
||
# Configures this workflow to run every time a change is pushed to the branch called `release`. | ||
on: | ||
push: | ||
branches: [master] | ||
|
||
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | ||
env: | ||
REGISTRY: ghcr.io | ||
|
||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | ||
jobs: | ||
build-and-push-image: | ||
strategy: | ||
matrix: | ||
image: [ "mapdiffbot2", "icondiffbot2" ] | ||
|
||
runs-on: ubuntu-latest | ||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
# | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ matrix.image }} | ||
|
||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ matrix.image }} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ jobs/ | |
|
||
diffbot.pem | ||
config.toml | ||
|
||
/config/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,5 @@ members = [ | |
] | ||
|
||
[profile.release] | ||
lto = true | ||
#lto = true | ||
debug = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM rust:1.82.0-slim-bookworm AS builder | ||
|
||
RUN apt-get update && apt-get install -y pkg-config libssl-dev make | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN --mount=type=cache,target=/app/target \ | ||
--mount=type=cache,target=/usr/local/cargo/registry \ | ||
cargo build --release && cp target/release/mapdiffbot2 target/release/icondiffbot2 . | ||
|
||
FROM debian:bookworm-20241016-slim AS base | ||
|
||
RUN apt-get update && apt-get install -y libssl3 | ||
USER 1000 | ||
WORKDIR /app | ||
|
||
FROM base AS mapdiffbot2 | ||
COPY --from=builder /app/mapdiffbot2 /app/mapdiffbot2 | ||
|
||
ENTRYPOINT /app/mapdiffbot2 | ||
|
||
FROM base AS icondiffbot2 | ||
COPY --from=builder /app/icondiffbot2 /app/icondiffbot2 | ||
|
||
ENTRYPOINT /app/icondiffbot2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
services: | ||
icondiffbot2: | ||
image: ghcr.io/spacestation13/icondiffbot2:latest | ||
build: | ||
target: icondiffbot2 | ||
init: true | ||
volumes: | ||
- type: bind | ||
source: ./config/icondiffbot2.toml | ||
target: /app/config.toml | ||
read_only: true | ||
- type: bind | ||
source: ./config/config | ||
target: /app/config | ||
read_only: true | ||
- icondiffbot2_images:/app/images | ||
mapdiffbot2: | ||
image: ghcr.io/spacestation13/mapdiffbot2:latest | ||
build: | ||
target: mapdiffbot2 | ||
init: true | ||
volumes: | ||
- type: bind | ||
source: ./config/mapdiffbot2.toml | ||
target: /app/config.toml | ||
read_only: true | ||
- type: bind | ||
source: ./config/config | ||
target: /app/config | ||
read_only: true | ||
- mapdiffbot2_images:/app/images | ||
- mapdiffbot2_repos:/app/repos | ||
volumes: | ||
icondiffbot2_images: | ||
mapdiffbot2_images: | ||
mapdiffbot2_repos: |