Skip to content

Commit 34bb9dd

Browse files
[FEATURE]: Create Docker image for CCExtractor (#1611)
* docs: Create a README for docker image usage * docs: Update `COMPILATION.md` for adding docker instruction * docs: Add detailed docker building & usage guide * feat: Add dockerfile * feat: Make dockerfile to build CCExtractor * fix: dockerfile * feat: Optimize docker image size * docs: fix some commands usage * docs: Mention docker image creation in CHANGES.txt * docs: Update readme to remove dockerhub method
1 parent 8d9bf42 commit 34bb9dd

File tree

4 files changed

+113
-0
lines changed

4 files changed

+113
-0
lines changed

docker/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# CCExtractor Docker image
2+
3+
This dockerfile prepares a minimalist Docker image with CCExtractor. It compiles CCExtractor from sources following instructions from the [Compilation Guide](https://github.com/CCExtractor/ccextractor/blob/master/docs/COMPILATION.MD).
4+
5+
You can install the latest build of this image by running `docker pull CCExtractor/ccextractor`
6+
7+
## Build
8+
9+
You can build the Docker image directly from the Dockerfile provided in [docker](https://github.com/CCExtractor/ccextractor/tree/master/docker) directory of CCExtractor source
10+
11+
```bash
12+
$ git clone https://github.com/CCExtractor/ccextractor.git && cd ccextractor
13+
$ cd docker/
14+
$ docker build -t ccextractor .
15+
```
16+
17+
## Usage
18+
19+
The CCExtractor Docker image can be used in several ways, depending on your needs.
20+
21+
```bash
22+
# General usage
23+
$ docker run ccextractor:latest <features>
24+
```
25+
26+
1. Process a local file & use `-o` flag
27+
28+
To process a local video file, mount a directory containing the input file inside the container:
29+
30+
```bash
31+
# Use `-o` to specifying output file
32+
$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) ccextractor:latest input.mp4 -o output.srt
33+
34+
# Alternatively use `--stdout` feature
35+
$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) ccextractor:latest input.mp4 --stdout > output.srt
36+
```
37+
38+
Run this command from where your input video file is present, and change `input.mp4` & `output.srt` with the actual name of files.
39+
40+
2. Enter an interactive environment
41+
42+
If you need to run CCExtractor with additional options or perform other tasks within the container, you can enter an interactive environment:
43+
bash
44+
45+
```bash
46+
$ docker run --rm -it --entrypoint='sh' ccextractor:latest
47+
```
48+
49+
This will start a Bash shell inside the container, allowing you to run CCExtractor commands manually or perform other operations.
50+
51+
### Example
52+
53+
I run help command in image built from `dockerfile`
54+
55+
```bash
56+
$ docker build -t ccextractor .
57+
$ docker run --rm ccextractor:latest --help
58+
```
59+
60+
This will show the `--help` message of CCExtractor tool
61+
From there you can see all the features and flags which can be used.

docker/dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM alpine:latest as base
2+
3+
FROM base as builder
4+
5+
RUN apk add --no-cache --update git curl gcc cmake glew glfw \
6+
tesseract-ocr-dev leptonica-dev clang-dev llvm-dev make pkgconfig \
7+
zlib-dev libpng-dev libjpeg-turbo-dev openssl-dev freetype-dev libxml2-dev
8+
9+
RUN cd && git clone https://github.com/gpac/gpac
10+
WORKDIR root/gpac/
11+
RUN ./configure && make && make install-lib && cd && rm -rf /root/gpac
12+
13+
WORKDIR /root
14+
RUN git clone https://github.com/CCExtractor/ccextractor.git
15+
RUN apk add bash cargo
16+
RUN export LIB_CLANG_PATH=$(find / -name 'libclang*.so*' 2>/dev/null | grep -v 'No such file' | head -n 1 | xargs dirname)
17+
RUN cd /root/ccextractor/linux && ./pre-build.sh && ./build
18+
19+
RUN cp /root/ccextractor/linux/ccextractor /ccextractor && rm -rf ~/ccextractor
20+
21+
FROM base as final
22+
23+
COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/
24+
COPY --from=builder /usr/lib/libtesseract.so.5 /usr/lib/
25+
COPY --from=builder /usr/lib/libleptonica.so.6 /usr/lib/
26+
COPY --from=builder /usr/local/lib/libgpac.so.12 /usr/local/lib/
27+
COPY --from=builder /usr/lib/libstdc++.so.6 /usr/lib/
28+
COPY --from=builder /usr/lib/libgcc_s.so.1 /usr/lib/
29+
COPY --from=builder /usr/lib/libgomp.so.1 /usr/lib/
30+
COPY --from=builder /usr/lib/libpng16.so.16 /usr/lib/
31+
COPY --from=builder /usr/lib/libjpeg.so.8 /usr/lib/
32+
COPY --from=builder /usr/lib/libgif.so.7 /usr/lib/
33+
COPY --from=builder /usr/lib/libtiff.so.6 /usr/lib/
34+
COPY --from=builder /usr/lib/libwebp.so.7 /usr/lib/
35+
COPY --from=builder /usr/lib/libwebpmux.so.3 /usr/lib/
36+
COPY --from=builder /lib/libz.so.1 /lib/
37+
COPY --from=builder /lib/libssl.so.3 /lib/
38+
COPY --from=builder /lib/libcrypto.so.3 /lib/
39+
COPY --from=builder /usr/lib/liblzma.so.5 /usr/lib/
40+
COPY --from=builder /usr/lib/libzstd.so.1 /usr/lib/
41+
COPY --from=builder /usr/lib/libsharpyuv.so.0 /usr/lib/
42+
43+
COPY --from=builder /ccextractor /
44+
45+
ENTRYPOINT [ "/ccextractor" ]
46+
47+
CMD [ "/ccextractor" ]
48+

docs/CHANGES.TXT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
0.95 (to be released)
22
-----------------
3+
- New: Create a Docker image to simplify the CCExtractor usage without any environmental hustle (#1611)
34
- New: Add time units module in lib_ccxr (#1623)
45
- New: Add bits and levenshtein module in lib_ccxr (#1627)
56
- New: Add constants module in lib_ccxr (#1624)

docs/COMPILATION.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Clone the latest repository from Github
1010
git clone https://github.com/CCExtractor/ccextractor.git
1111
```
1212

13+
## Docker
14+
You can now use docker image to build latest source of CCExtractor without any environmental hustle. Follow these [instructions](https://github.com/CCExtractor/ccextractor/tree/master/docker/README.md) for building docker image & usage of it.
15+
1316
## Linux
1417

1518
1. Make sure all the dependencies are met.

0 commit comments

Comments
 (0)