Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions packaging/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# syntax = docker/dockerfile:experimental
#
# Requires Docker v18.06 or later and BuildKit mode to use cache mount
# Docker v18.06 also requires the daemon to be running in experimental mode.
#
# $ export DOCKER_BUILDKIT=1
#
# See https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md
#
# To build for arm, see https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux/
#
# Build targets supported:
# docker build --build-arg=TARGET=pld packaging
# docker build --build-arg=TARGET=debian packaging
# docker build --build-arg=TARGET=fedora packaging

ARG VERSION=v1.0pre7
ARG TARGET=debian

FROM alpine AS source
RUN apk add git curl patch
ARG VERSION
RUN git clone --depth=1 -b $VERSION https://github.com/ruediger/VobSub2SRT /source
WORKDIR /source
RUN curl -sSfLO https://github.com/ruediger/VobSub2SRT/pull/72.patch
RUN patch -p1 < 72.patch

## Debian
FROM debian:buster AS runtime-debian
RUN --mount=type=cache,id=apt,target=/var/cache/apt \
apt update && apt install -y \
libtesseract4
FROM runtime-debian AS build-debian
RUN --mount=type=cache,id=apt,target=/var/cache/apt \
apt install -y \
build-essential cmake libtesseract-dev libtiff5-dev pkg-config tesseract-ocr-eng

## PLD Linux
FROM registry.gitlab.com/pld-linux/pld AS runtime-pld
RUN --mount=type=cache,id=poldek,target=/var/cache/poldek \
poldek -O 'keep downloads=yes' --up -u \
tesseract
FROM runtime-pld AS build-pld
RUN --mount=type=cache,id=poldek,target=/var/cache/poldek \
poldek -O 'keep downloads=yes' -u \
cmake gzip libtiff-devel make tesseract-devel

## Fedora Linux
FROM fedora:31 AS runtime-fedora
RUN --mount=type=cache,id=dnf,target=/var/cache/dnf \
dnf install -y \
tesseract
FROM runtime-fedora AS build-fedora
RUN --mount=type=cache,id=dnf,target=/var/cache/dnf \
dnf install -y \
cmake g++ libtiff-devel make tesseract-devel

FROM build-$TARGET AS build
WORKDIR /build
COPY --from=source /source .
RUN ./configure
RUN make
RUN make install
RUN strip /usr/local/bin/*

FROM runtime-$TARGET AS runtime
COPY --from=build /usr/local/bin/* /usr/local/bin