-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
46 lines (29 loc) · 1.02 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM golang:1.22.0-bookworm as builder
RUN apt update && apt install curl unzip -y
ENV GOPATH=/go
RUN go install github.com/google/wire/cmd/[email protected]
WORKDIR /src
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download || true
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
# Build docker
RUN make di static
######## Start a new stage from scratch #######
FROM alpine:3.13 as production
RUN apk --no-cache add ca-certificates tzdata htop tini bash curl
RUN rm -rf /tmp/*
# Change timezone to UTC/GMT
ENV TZ=UTC
RUN cp /usr/share/zoneinfo/UTC /etc/localtime
# Copy the Pre-built binary file from the previous stage
COPY --from=builder /src/out /bin/
# Copy resources file
# COPY --from=builder /src/docs /docs/
# COPY --from=builder /src/resources /resources/
# Expose ports
EXPOSE 8081
# Command to run the executable
CMD ["tini", "--", "/bin/price_feed"]