-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
33 lines (23 loc) · 865 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
33
# Use the official golang 1.21 bookworm image as the base image
FROM golang:1.21-bookworm AS base
# Set the working directory to /gocash
WORKDIR /gocash
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages need to build webminer
RUN apt-get update -qq && \
apt-get install -y build-essential git && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Install latest version of libsha2
RUN git clone https://github.com/maaku/libsha2
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY *.go ./
# Build webminer
RUN go build -o bin/webminer webminer.go
# Final stage
FROM base
# Copy built artifacts: webminer
COPY --from=build /gocash/bin/webminer /webminer
CMD ["/webminer"]