-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-chrome
44 lines (31 loc) · 1.58 KB
/
Dockerfile-chrome
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
FROM golang:1.18-alpine as builder
MAINTAINER tnek
RUN apk add --no-cache ca-certificates git
RUN mkdir /user && \
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
echo 'nobody:x:65534:' > /user/group
ADD keys/deploy_id_rsa /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
RUN git config --global url.ssh://[email protected]/.insteadOf https://github.com/
WORKDIR /src
COPY ./go.mod ./go.sum ./
COPY . .
RUN go mod tidy
RUN CGO_ENABLED=0 go build \
-installsuffix 'static' \
-o /ctf-browser-visitor .
FROM debian:latest
RUN apt-get update && apt-get install -y wget xvfb openjdk-11-jre software-properties-common wget chromium curl unzip libc6-amd64-cross libc6-dev
COPY --from=builder /user/group /user/passwd /etc/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /ctf-browser-visitor /ctf-browser-visitor
# Chromedriver
RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
# set display port to avoid crash
ENV DISPLAY=:99
ENV SELENIUM_JAR_ADDR=https://github.com/SeleniumHQ/selenium/releases/download/selenium-3.141.59/selenium-server-standalone-3.141.59.jar
RUN curl -sL $SELENIUM_JAR_ADDR > /usr/local/bin/selenium-server.jar
EXPOSE 3000
CMD ["./ctf-browser-visitor", "--selenium=/usr/local/bin/selenium-server.jar", "--driver=/usr/local/bin/chromedriver", "0.0.0.0", "3000"]