如何在 Dockerfile 中将 Ubuntu package/repository 转换为 Alpine?

How to convert an Ubuntu package/repository to Alpine in a Dockerfile?

目前我有这个Dockerfile

FROM ubuntu:18.04

# https://github.com/tesseract-shadow/tesseract-ocr-re
RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:alex-p/tesseract-ocr
RUN apt-get update && apt-get install -y tesseract-ocr-all
RUN apt-get install -y git build-essential cmake
RUN apt-get install -y ffmpeg

# Install Node and NPM
RUN apt-get install nodejs -y && apt-get install npm -y

图片太大所以我搜索了替代品并找到了 Alpine。

我被这个卡住了

FROM alpine

RUN apk add --update ffmpeg cmake nodejs npm

查看 aline edge 存储库,我似乎找不到 tesseract-ocr-all 并且不知道如何在 alpine 中执行 apt-get install -y software-properties-common && add-apt-repository -y ppa:alex-p/tesseract-ocr

有什么资源可以帮助我解决这个问题吗?我应该为那些 packages/repositories 制作自己的 Alpine 图像吗?

高山包名称是tesseract-ocr, you can check here the releases or alpine repository

FROM alpine

RUN apk add --update --no-cache ffmpeg cmake nodejs npm tesseract-ocr

如果您对测试版感兴趣,可以查看 here

始终尝试添加 --no-cache 选项允许不在本地缓存索引,这样可以保持容器较小。