31 lines
992 B
Docker
31 lines
992 B
Docker
############################
|
|
# STEP 1 build executable binary
|
|
############################
|
|
FROM golang:alpine AS builder
|
|
# Install git.
|
|
# Git is required for fetching the dependencies.
|
|
RUN apk update && \
|
|
apk add --no-cache ca-certificates pkgconf git libxml2-dev oniguruma-dev && \
|
|
apk add --virtual build-dependencies build-base gcc wget git && \
|
|
mkdir -p /opt/build
|
|
WORKDIR /opt/build
|
|
COPY . .
|
|
# Fetch dependencies.
|
|
# Using go get.
|
|
RUN go get -d -v
|
|
# Build the binary.
|
|
RUN go build -o /go/bin/fbBot .
|
|
############################
|
|
# STEP 2 build a small image
|
|
############################
|
|
FROM alpine
|
|
VOLUME /opt/tmp
|
|
RUN apk update && \
|
|
apk add --no-cache ca-certificates chromium chromium-chromedriver
|
|
# Copy our static executable.
|
|
COPY --from=builder /go/bin/fbBot /opt/fbBot
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
COPY contrib/ /
|
|
COPY config.yaml /etc/fbBot/config.yaml
|
|
# Run the hello binary.
|
|
ENTRYPOINT ["/opt/fbBot"] |