rod / Dockerfile
aripbae's picture
Update Dockerfile
6fced29 verified
Raw
History Blame Contribute Delete
1.17 kB
FROM golang:bookworm AS builder
WORKDIR /app
RUN go mod init hf-rod-api && \
go get github.com/go-rod/rod && \
go get github.com/go-rod/stealth
COPY main.go ./
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o main .
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
gnupg \
ca-certificates \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update && apt-get install -y --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/main .
RUN mkdir -p /tmp && chmod 777 /tmp
ENV CHROME_PATH=/usr/bin/google-chrome-stable
ENV HOME=/tmp
EXPOSE 7860
CMD ["./main"]