Compare commits

...

36 Commits
v1.0.1 ... main

Author SHA1 Message Date
bizcochito 49a2b2a234 Merge pull request 'Update Rust crate tokio to v1.42.0' (#18) from renovate/tokio-1.x-lockfile into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m32s Details
Reviewed-on: #18
2024-12-03 16:31:07 +00:00
Renovate Bot c215c16a78 Update Rust crate tokio to v1.42.0
Unit Tests with docker compose and cargo / unit-test (push) Successful in 51s Details
2024-12-03 14:04:26 +00:00
bizcochito b22221e6c3 Merge pull request 'Update rust Docker tag to v1.83.0' (#17) from renovate/rust-1.x into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 38s Details
Build image / build (push) Successful in 41m4s Details
Reviewed-on: #17
2024-12-03 12:05:19 +00:00
Renovate Bot b7229f2467 Update rust Docker tag to v1.83.0
Unit Tests with docker compose and cargo / unit-test (push) Successful in 49s Details
2024-12-03 12:01:42 +00:00
Alie 8fff379f54 refactor docker tests and build
Unit Tests with docker compose and cargo / unit-test (push) Successful in 48s Details
2024-12-03 12:53:03 +01:00
Alie e45088c1a8 have docker version in compose too
Unit Tests with docker compose and cargo / unit-test (push) Failing after 1m29s Details
2024-12-03 11:17:38 +01:00
bizcochito 0f307b36cc Merge pull request 'Update docker/setup-buildx-action action to v3' (#16) from renovate/docker-setup-buildx-action-3.x into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m53s Details
Reviewed-on: #16
2024-12-01 17:02:11 +00:00
bizcochito 89fa9a1e1c Merge pull request 'Update docker/metadata-action action to v5' (#15) from renovate/docker-metadata-action-5.x into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 3m38s Details
Reviewed-on: #15
2024-12-01 17:01:54 +00:00
bizcochito dd77f3566f Merge pull request 'Update docker/login-action action to v3' (#14) from renovate/docker-login-action-3.x into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m47s Details
Reviewed-on: #14
2024-12-01 13:33:57 +00:00
Renovate Bot c29dcac079 Update docker/setup-buildx-action action to v3
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m54s Details
Build image / build (pull_request) Successful in 51m42s Details
2024-12-01 12:33:47 +00:00
Renovate Bot 1ab2f26c08 Update docker/metadata-action action to v5
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m54s Details
Build image / build (pull_request) Successful in 50m26s Details
2024-12-01 12:33:43 +00:00
Renovate Bot ed501bed87 Update docker/login-action action to v3
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m45s Details
Build image / build (pull_request) Successful in 53m21s Details
2024-12-01 12:33:40 +00:00
bizcochito 2b3796ccab Merge pull request 'Update docker/build-push-action action to v6' (#13) from renovate/docker-build-push-action-6.x into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 3m4s Details
Reviewed-on: #13
2024-12-01 12:21:17 +00:00
Alie e76b6b85c0 if pull request modifies build.yaml it sould run
Unit Tests with docker compose and cargo / unit-test (push) Successful in 3m0s Details
2024-12-01 12:24:28 +01:00
bizcochito d786d6a1ca Merge branch 'main' into renovate/docker-build-push-action-6.x
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m49s Details
Build image / build (pull_request) Successful in 51m58s Details
2024-12-01 11:22:10 +00:00
bizcochito ce4c735a55 Merge pull request 'Update actions/checkout action to v4' (#12) from renovate/actions-checkout-4.x into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 3m13s Details
Reviewed-on: #12
2024-12-01 11:16:02 +00:00
bizcochito 07824e1710 Merge pull request 'Update rust Docker tag to v1.82.0' (#11) from renovate/rust-1.x into main
Unit Tests with docker compose and cargo / unit-test (push) Has been cancelled Details
Reviewed-on: #11
2024-12-01 11:13:53 +00:00
Renovate Bot 13a1d2e149 Update docker/build-push-action action to v6
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m44s Details
2024-11-29 20:03:00 +00:00
Renovate Bot 7ec6c63496 Update actions/checkout action to v4
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m56s Details
2024-11-29 19:02:34 +00:00
Renovate Bot 4977312f9f Update rust Docker tag to v1.82.0
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m50s Details
2024-11-29 19:02:32 +00:00
bizcochito 1c62348f18 Merge pull request 'Update git.fai.st/fedi-image-bot/bot-api Docker tag to v1.0.2' (#10) from renovate/git.fai.st-fedi-image-bot-bot-api-1.x into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m52s Details
Reviewed-on: #10
2024-11-29 18:45:27 +00:00
bizcochito 04c39ce18b Merge branch 'main' into renovate/git.fai.st-fedi-image-bot-bot-api-1.x
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m49s Details
2024-11-29 18:08:57 +00:00
bizcochito 72cfd516ec Merge pull request 'develop' (#8) from develop into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m16s Details
Reviewed-on: #8
2024-11-29 18:07:23 +00:00
Alie 69199c79a6 change actions
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m41s Details
2024-11-29 19:07:16 +01:00
Renovate Bot 13d445c945 Update git.fai.st/fedi-image-bot/bot-api Docker tag to v1.0.2
Unit Tests with docker compose and cargo / unit-test (pull_request) Successful in 1m49s Details
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m53s Details
2024-11-29 17:58:57 +00:00
Alie 7fb94e17db fix dockerfile
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m58s Details
2024-11-29 16:49:59 +01:00
Alie 0c2ee8a69b update compose yaml 2024-11-29 16:35:27 +01:00
bizcochito 6864bb03d2 Merge pull request 'develop' (#5) from develop into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m38s Details
Build image / build (push) Failing after 6m11s Details
Reviewed-on: #5
2024-11-29 15:09:50 +00:00
bizcochito c0f9a83138 Merge pull request 'Configure Renovate' (#3) from renovate/configure into develop
Unit Tests with docker compose and cargo / unit-test (push) Successful in 2m0s Details
Unit Tests with docker compose and cargo / unit-test (pull_request) Successful in 1m55s Details
Reviewed-on: #3
2024-11-29 15:08:36 +00:00
bizcochito 8200539456 Merge branch 'develop' into renovate/configure
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m42s Details
Unit Tests with docker compose and cargo / unit-test (pull_request) Successful in 1m38s Details
2024-11-29 15:04:20 +00:00
bizcochito b98e3c69a4 Merge pull request 'main' (#4) from main into develop
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m42s Details
Reviewed-on: #4
2024-11-29 15:03:11 +00:00
bizcochito 4f2b18b447 Merge branch 'develop' into main
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m43s Details
Build image / build (push) Failing after 6m23s Details
Unit Tests with docker compose and cargo / unit-test (pull_request) Successful in 1m39s Details
2024-11-29 14:43:47 +00:00
Alie ceb57052ed fix issues with time
Build image / build (push) Waiting to run Details
Unit Tests with docker compose and cargo / unit-test (push) Has been cancelled Details
Unit Tests with docker compose and cargo / unit-test (pull_request) Failing after 55s Details
2024-11-29 15:44:39 +01:00
Renovate Bot 1c6999cef2 Add renovate.json
Unit Tests with docker compose and cargo / unit-test (push) Failing after 6m47s Details
Unit Tests with docker compose and cargo / unit-test (pull_request) Failing after 2m7s Details
2024-11-23 11:43:33 +00:00
Alie fdad62f0b2 starting
Unit Tests with docker compose and cargo / unit-test (push) Successful in 4m43s Details
Build image / build (push) Successful in 59m9s Details
2024-05-29 20:37:25 +02:00
Alie 02981fefb3 Merge branch 'develop'
Unit Tests with docker compose and cargo / unit-test (push) Successful in 1m15s Details
Build image / build (push) Successful in 33m19s Details
2024-02-23 19:47:54 +01:00
9 changed files with 717 additions and 707 deletions

View File

@ -1,2 +1,2 @@
[alias]
t="test -- --test-threads=1"
t = "test -- --test-threads=1 --nocapture"

View File

@ -1,35 +0,0 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/engine/reference/builder/#dockerignore-file
**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/secrets.dev.yaml
**/values.dev.yaml
/bin
/target
LICENSE
README.md
config.toml
mastodon-data.toml
*.yaml

View File

@ -1,5 +1,5 @@
name: Unit Tests with docker compose and cargo
on: [push, pull_request]
on: [push]
jobs:
unit-test:
@ -15,8 +15,8 @@ jobs:
- name: Installing necessary packages
run: apk add nodejs git curl bash
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get access token from secret
run: echo "${{ secrets.MASTODON_SECRET }}" > mastodon-data.toml
- name: Run tests on docker
run: docker compose down -v && docker compose run bot t
run: docker compose down -v && docker compose run bot t

View File

@ -1,12 +1,12 @@
name: Build image
on:
pull_request:
paths:
- .gitea/workflows/02_build.yaml
push:
branches:
- main
- build
tags:
- v*
jobs:
build:
container:
@ -21,32 +21,32 @@ jobs:
- name: Installing necessary packages
run: apk add nodejs git curl bash
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: https://github.com/docker/metadata-action@v4
uses: https://github.com/docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
git.fai.st/fedi-image-bot/mastodon-image-uploader-bot
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=latest
type=ref,event=branch
type=semver,pattern={{raw}}
type=semver,pattern={{raw}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to fai.st docker registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: git.fai.st
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}

1238
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +1,32 @@
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/
################################################################################
# Create a stage for building the application.
ARG RUST_VERSION=1.71.0
ARG APP_NAME=mastodon-image-uploader-bot
FROM rust:${RUST_VERSION}-slim-bullseye AS build
ARG APP_NAME
WORKDIR /app
FROM rust:1.83.0-slim-bullseye AS deps
RUN apt update && apt install pkg-config openssl libssl-dev -y
# Build the application.
# Leverage a cache mount to /usr/local/cargo/registry/
# for downloaded dependencies and a cache mount to /app/target/ for
# compiled dependencies which will speed up subsequent builds.
# Leverage a bind mount to the src directory to avoid having to copy the
# source code into the container. Once built, copy the executable to an
# output directory before the cache mounted /app/target is unmounted.
RUN --mount=type=bind,source=src,target=src \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
<<EOF
WORKDIR /app
COPY src src
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
FROM deps AS test
COPY .cargo .cargo
COPY config.toml config.toml
COPY mastodon-data.toml mastodon-data.toml
RUN cargo build
FROM deps AS build
ARG APP_NAME=mastodon-image-uploader-bot
WORKDIR /app
RUN <<EOF
set -e
cargo build --locked --release
ls ./target/release/$APP_NAME
cp ./target/release/$APP_NAME /bin/bot
EOF
################################################################################
# Create a new stage for running the application that contains the minimal
# runtime dependencies for the application. This often uses a different base
# image from the build stage where the necessary files are copied from the build
# stage.
#
# The example below uses the debian bullseye image as the foundation for running the app.
# By specifying the "bullseye-slim" tag, it will also use whatever happens to be the
# most recent version of that tag when you build your Dockerfile. If
# reproducability is important, consider using a digest
# (e.g., debian@sha256:ac707220fbd7b67fc19b112cee8170b41a9e97f703f588b2cdbbcdcecdd8af57).
FROM debian:bullseye-slim AS final
WORKDIR /app
RUN apt update && apt install pkg-config openssl libssl-dev curl -y
# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
RUN apt update && apt install pkg-config openssl libssl-dev -y
ARG UID=10001
RUN adduser \
--disabled-password \
@ -54,8 +36,6 @@ RUN adduser \
botuser
USER botuser
# Copy the executable from the "build" stage.
COPY --from=build /bin/bot /bin/
# What the container should run when it is started.
CMD ["/bin/bot"]

View File

@ -1,11 +1,9 @@
version: "3"
services:
mongodb:
image: mongo:bionic
container_name: mongodb
container_name: mongodb-bot-cron
ports:
- "27017:27017"
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
@ -15,27 +13,25 @@ services:
- mongodb_data:/data/db
bot-api:
image: git.fai.st/fedi-image-bot/bot-api:v1.0.0
container_name: bot-api
image: git.fai.st/fedi-image-bot/bot-api:v1.0.2
container_name: bot-api-bot-cron
ports:
- "8080:8080"
- 8080:8080
depends_on:
- mongodb
environment:
MONGODB_URI: "mongodb://mongodb:27017/bot"
MONGODB_USER: "root"
MONGODB_PASS: "password"
JWTSECRET: "cooljwtsecret"
MONGODB_URI: mongodb://mongodb:27017/bot
MONGODB_USER: root
MONGODB_PASS: password
JWTSECRET: cooljwtsecret
bot:
image: rust
container_name: bot
working_dir: /app
build:
target: test
entrypoint: ["cargo"]
container_name: bot-cron
depends_on:
- bot-api
volumes:
- ./:/app:rw
volumes:
mongodb_data:
mongodb_data:

View File

@ -1,28 +0,0 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: bot-cronjob
spec:
schedule: "* */6 * * *" # Runs every 6 hours
jobTemplate:
spec:
template:
spec:
containers:
- name: bot-job
image: git.fai.st/fedi-image-bot/mastodon-image-uploader-bot:v1.0.0
volumeMounts:
- name: config-toml
mountPath: /app/config.toml
readOnly: true
- name: mastodon-token
mountPath: /app/mastodon-data.toml
readOnly: true
restartPolicy: Never
volumes:
- name: config-toml
configMap:
name: bot-config-toml
- name: mastodon-token
secret:
secretName: mastodon-data

3
renovate.json Normal file
View File

@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}