forked from NethermindEth/tx-fuzz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
32 lines (23 loc) · 962 Bytes
/
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
FROM golang:1.18-alpine AS builder
# We disable CGO here due to:
# 1) https://github.com/golang/go/issues/28065 that prevents 'go test' from running inside an Alpine container
# 2) https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host which
# which prevents from just switching to the Buster build image
# Sadly, this is slower: https://stackoverflow.com/questions/47714278/why-is-compiling-with-cgo-enabled-0-slower
ENV CGO_ENABLED=0
WORKDIR /build
# Copy and download dependencies using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the code into the container
COPY . .
RUN go test ./...
# Build the application
RUN GOOS=linux go build -o tx-fuzz.bin ./cmd/livefuzzer
# ============= Execution Stage ================
FROM alpine:3.12 AS execution
WORKDIR /run
# Copy the code into the container
COPY --from=builder /build/tx-fuzz.bin .
ENTRYPOINT ["./tx-fuzz.bin"]