generated from andskur/go-microservice-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
37 lines (28 loc) · 1015 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
34
35
36
37
# Use the latest version of Go as the base image
FROM golang:1.19 AS base
# Install needed dependencies for base image and update certs
RUN apt-get update \
&& apt-get install -y make openssh-client ca-certificates unzip \
&& update-ca-certificates
# create a build artifact
FROM base AS builder
# Set the working directory to the root of the project
WORKDIR /app
# Copy the Go dependencies file and download the dependencies
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the Makefile and the rest of the source code
COPY Makefile .
COPY .git ./.git
COPY . ./
# Build the application
RUN make build
# Create a new, smaller image based on the scratch image (an empty, executable image)
FROM scratch
# Copy the SSL certificates from the base image
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy the built executable from the builder image
COPY --from=builder /app/quasar-evm /quasar-evm
# Set the entrypoint to the executable
ENTRYPOINT ["/quasar-evm", "serve"]