forked from pdfcpu/pdfcpu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (36 loc) · 1.16 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Dockerfile References: https://docs.docker.com/engine/reference/builder/
#
# Usage:
#
# docker build -t pdfcpu .
#
# Simple one off container:
# docker run pdfcpu
#
# One off container with dir binding:
# docker run -v $(pwd):/data -it --rm pdfcpu pdfcpu val test.pdf
#
# Create & run reusable container with dir binding:
# docker run --name pdfcpu -v $(pwd):/data -it pdfcpu /bin/sh
# /data # ... // run pdfcpu commands against your data
# /data # exit // exit container
#
# docker start -i pdfcpu // restart container with dir binding
# /data # ... // run pdfcpu commands against your data
# /data # exit // exit container
# Start from the latest golang base image
FROM golang:latest as builder
# install
RUN go install github.com/pdfcpu/pdfcpu/cmd/pdfcpu@latest
######## Start a new stage from scratch #######
FROM alpine:latest
RUN apk --no-cache add ca-certificates gcompat
WORKDIR /root
# Copy the pre-built binary file from the previous stage
COPY --from=builder /go/bin ./
# Export path of executable
ENV PATH="${PATH}:/root"
VOLUME /app
WORKDIR /app
# Entrypoint for container default executable
ENTRYPOINT ["pdfcpu"]