Skip to content

Commit

Permalink
build restserver as well
Browse files Browse the repository at this point in the history
  • Loading branch information
pschichtel committed Oct 22, 2024
1 parent 033feb1 commit c96dbbc
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 24 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/container-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@ name: Container Images
on:
workflow_dispatch:
push:
paths:
- images/**
branches:
- main
create:
tags:
- v*


jobs:
build:
build-joex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
run: |
cd images
./build joex
build-restserver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -23,16 +35,6 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
run: |
repo="ghcr.io/docspell/joex"
image_name="${repo}:latest"
docker build --cache-from type=gha --cache-to type=gha,mode=max -t "$image_name" -f Dockerfile.joex .
docker push "$image_name"
full_version="$(docker run --rm --entrypoint cat "$image_name" /opt/docspell-joex/version)"
full_version_name="${repo}:v${full_version}"
docker tag "$image_name" "$full_version_name"
docker push "$full_version_name"
minor_version="$(cut -d'.' -f1 <<< "$full_version").$(cut -d'.' -f2 <<< "$full_version")"
minor_version_name="${repo}:v${minor_version}"
docker tag "$image_name" "$minor_version_name"
docker push "$minor_version_name"
cd images
./build restserver
10 changes: 3 additions & 7 deletions Dockerfile.joex → images/Dockerfile.joex
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ARG DOCSPELL_VERSION=0.42.0

FROM docker.io/library/ubuntu:oracular-20241009 AS base

RUN apt update \
Expand Down Expand Up @@ -30,22 +28,20 @@ RUN apt install -y \

WORKDIR /opt

ARG DOCSPELL_VERSION
ARG DOCSPELL_VERSION=0.42.0
RUN curl -sLfo joex.zip "https://github.com/eikek/docspell/releases/download/v${DOCSPELL_VERSION}/docspell-joex-${DOCSPELL_VERSION}.zip" && \
unzip joex.zip && \
rm joex.zip && \
mv docspell-joex-* docspell-joex && \
rm docspell-joex/conf/docspell-joex.conf
rm docspell-joex/conf/docspell-joex.conf && \
echo "$DOCSPELL_VERSION" > docspell-joex/version

FROM base

COPY --from=download /opt/docspell-joex /opt/docspell-joex

COPY joex-entrypoint.sh /opt/joex-entrypoint.sh

ARG DOCSPELL_VERSION
RUN echo "$DOCSPELL_VERSION" > /opt/docspell-joex/version

ENTRYPOINT ["/opt/joex-entrypoint.sh"]
EXPOSE 7878

32 changes: 32 additions & 0 deletions images/Dockerfile.restserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM docker.io/library/ubuntu:oracular-20241009 AS base

RUN apt update \
&& apt full-upgrade -y

RUN apt install -y \
tzdata \
openjdk-21-jre

FROM base AS download

RUN apt install -y \
curl \
unzip

WORKDIR /opt

ARG DOCSPELL_VERSION=0.42.0
RUN curl -sLfo restserver.zip "https://github.com/eikek/docspell/releases/download/v${DOCSPELL_VERSION}/docspell-restserver-${DOCSPELL_VERSION}.zip" && \
unzip restserver.zip && \
rm restserver.zip && \
mv docspell-restserver-* docspell-restserver && \
rm docspell-restserver/conf/docspell-restserver.conf && \
echo "$DOCSPELL_VERSION" > docspell-restserver/version

FROM base

COPY --from=download /opt/docspell-restserver /opt/docspell-restserver

ENTRYPOINT ["/opt/docspell-restserver/bin/docspell-restserver"]
EXPOSE 7880

19 changes: 19 additions & 0 deletions images/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -euo pipefail

name="${1?no name}"

repo="ghcr.io/docspell/$name"
image_name="${repo}:latest"
docker build --cache-from type=gha --cache-to type=gha,mode=max -t "$image_name" -f "Dockerfile.$name" .
docker push "$image_name"
full_version="$(docker run --rm --entrypoint cat "$image_name" "/opt/docspell-$name/version")"
full_version_name="${repo}:v${full_version}"
docker tag "$image_name" "$full_version_name"
docker push "$full_version_name"
minor_version="$(cut -d'.' -f1 <<< "$full_version").$(cut -d'.' -f2 <<< "$full_version")"
minor_version_name="${repo}:v${minor_version}"
docker tag "$image_name" "$minor_version_name"
docker push "$minor_version_name"

File renamed without changes.

0 comments on commit c96dbbc

Please sign in to comment.