Merge pull request #49 from Trivernis/develop

Develop
develop
Julius Riegel 2 years ago committed by GitHub
commit 8a77e38ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
name: Build Docker Container name: Build Container
on: on:
workflow_dispatch: workflow_dispatch:
@ -28,23 +28,28 @@ jobs:
- name: Cache Docker layers - name: Cache Docker layers
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: /tmp/.buildx-cache path: /var/lib/containers/
key: ${{ runner.os }}-buildx-${{ hashFiles('Cargo.lock') }} key: ${{ runner.os }}-podman-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ runner.os }}-buildx- ${{ runner.os }}-podman-
- name: Build
id: build-image
uses: redhat-actions/buildah-build@v2
with:
context: .
layers: true
containerfiles: ./Containerfile
platforms: ${{github.event.inputs.platforms}}
image: trivernis/tobi
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v1 uses: redhat-actions/podman-login@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push registry: docker.io
uses: docker/build-push-action@v2 - name: Push
uses: redhat-actions/push-to-registry@v2
with: with:
context: . image: ${{ steps.build-image.outputs.image }}
file: ./Dockerfile tags: ${{ steps.build-image.outputs.tags }}
platforms: ${{github.event.inputs.platforms}} registry: docker.io
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
trivernis/tobi:latest

@ -1,9 +1,7 @@
# syntax=docker/dockerfile:1.0-experimental
ARG QALCULATE_VERSION=4.1.1 ARG QALCULATE_VERSION=4.1.1
ARG DEBIAN_RELEASE=bullseye ARG DEBIAN_RELEASE=bullseye
FROM rust:slim-${DEBIAN_RELEASE} AS builder FROM docker.io/rust:slim-${DEBIAN_RELEASE} AS builder
RUN apt-get update RUN apt-get update
RUN apt-get install -y build-essential libssl-dev libopus-dev libpq-dev pkg-config RUN apt-get install -y build-essential libssl-dev libopus-dev libpq-dev pkg-config
WORKDIR /usr/src WORKDIR /usr/src
@ -14,12 +12,18 @@ COPY src ./src
COPY bot-coreutils ./bot-coreutils COPY bot-coreutils ./bot-coreutils
COPY bot-database ./bot-database COPY bot-database ./bot-database
RUN --mount=type=cache,target=/usr/local/cargo/registry \ RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=target \ --mount=type=cache,target=/usr/src/tobi/target \
cargo build --release cargo build --release
RUN mkdir /tmp/tobi RUN mkdir /tmp/tobi
RUN --mount=type=cache,target=target cp target/release/tobi-rs /tmp/tobi/ RUN --mount=type=cache,target=/usr/src/tobi/target cp target/release/tobi-rs /tmp/tobi/
FROM docker.io/bitnami/minideb:${DEBIAN_RELEASE} AS runtime-base
RUN apt update
RUN apt install openssl libopus0 ffmpeg python3 python3-pip libpq5 pkg-config -y
RUN pip3 install youtube-dl
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/ /var/cache
FROM bitnami/minideb:${DEBIAN_RELEASE} AS qalculate-builder FROM docker.io/bitnami/minideb:${DEBIAN_RELEASE} AS qalculate-builder
ARG QALCULATE_VERSION ARG QALCULATE_VERSION
RUN mkdir /tmp/qalculate RUN mkdir /tmp/qalculate
WORKDIR /tmp/qalculate WORKDIR /tmp/qalculate
@ -28,11 +32,7 @@ RUN wget https://github.com/Qalculate/qalculate-gtk/releases/download/v${QALCULA
RUN tar xf qalculate.tar.xz RUN tar xf qalculate.tar.xz
RUN cp qalculate-${QALCULATE_VERSION}/* /tmp/qalculate RUN cp qalculate-${QALCULATE_VERSION}/* /tmp/qalculate
FROM bitnami/minideb:${DEBIAN_RELEASE} FROM runtime-base
RUN apt update
RUN apt install openssl libopus0 ffmpeg python3 python3-pip libpq5 pkg-config -y
COPY --from=qalculate-builder /tmp/qalculate/* /usr/bin/ COPY --from=qalculate-builder /tmp/qalculate/* /usr/bin/
COPY --from=builder /tmp/tobi/tobi-rs . COPY --from=builder /tmp/tobi/tobi-rs .
RUN pip3 install youtube-dl
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/ /var/cache
ENTRYPOINT ["/tobi-rs"] ENTRYPOINT ["/tobi-rs"]
Loading…
Cancel
Save