forked from go-rod/rod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (36 loc) · 1.34 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
47
48
# Examples:
#
# docker build -t rodorg/rod -f lib/docker/Dockerfile .
#
# // use mirrors
# docker build --build-arg goproxy=https://goproxy.io,direct --build-arg alpine_mirror=mirrors.tuna.tsinghua.edu.cn \
# -t rodorg/rod -f lib/docker/Dockerfile .
# build rod-launcher tool
FROM golang:alpine AS go
ARG goproxy=""
COPY . /rod
WORKDIR /rod
RUN go env -w GO111MODULE=on && go env -w GOPROXY=$goproxy
RUN go build ./lib/launcher/rod-launcher
# use alpine to build the image
FROM alpine:latest
ARG alpine_mirror="dl-cdn.alpinelinux.org"
# to take advantage of the cache, don't put everything in one line
RUN sed -i "s/dl-cdn.alpinelinux.org/$alpine_mirror/g" /etc/apk/repositories
RUN cat /etc/apk/repositories
RUN apk update
RUN apk add chromium
# install fonts for pupular languages, so that screenshot for webpages can work properly
# https://wiki.alpinelinux.org/wiki/Fonts
# https://en.wikipedia.org/wiki/Languages_used_on_the_Internet
RUN apk add font-noto
RUN apk add font-noto-cjk
RUN apk add font-noto-arabic font-noto-thai font-noto-devanagari
RUN apk add font-noto-emoji --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
COPY lib/docker/fonts-local.conf /etc/fonts/local.conf
# timezone support
RUN apk add tzdata
COPY --from=go /rod/rod-launcher /usr/bin/
CMD rod-launcher
# the default port for rod-launcher
EXPOSE 9222