2020-04-03 15:43:59 +00:00
|
|
|
# build image
|
|
|
|
FROM golang:1.14.0-alpine as builder
|
|
|
|
|
|
|
|
RUN apk update && apk upgrade && \
|
|
|
|
apk add --no-cache bash git openssh
|
|
|
|
|
|
|
|
WORKDIR /app
|
2020-04-06 14:45:57 +00:00
|
|
|
|
|
|
|
# Copy and download dependencies to cache them and faster build time
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go mod download
|
|
|
|
|
2020-04-03 15:43:59 +00:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Test then build app
|
2020-04-05 14:59:01 +00:00
|
|
|
RUN go build -v github.com/creekorful/trandoshan/cmd/crawler
|
2020-04-03 15:43:59 +00:00
|
|
|
|
|
|
|
# runtime image
|
|
|
|
FROM alpine:latest
|
|
|
|
COPY --from=builder /app/crawler /app/
|
|
|
|
|
|
|
|
WORKDIR /app/
|
|
|
|
|
|
|
|
ENTRYPOINT ["./crawler"]
|