-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.local
More file actions
38 lines (29 loc) · 1.02 KB
/
Dockerfile.local
File metadata and controls
38 lines (29 loc) · 1.02 KB
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
FROM golang:1.19 as builder
# Create and change to the app directory.
WORKDIR /app
# ENV
ENV PORT 8080
# Expose ports
EXPOSE 8080
# Retrieve application dependencies.
# This allows the container build to reuse cached dependencies.
COPY go.* ./
RUN go mod download
# Copy local code to the container image.
COPY . ./
WORKDIR /app/lshelper
RUN go build -mod=readonly -v -o lshelperbin
# RUN ./lshelperbin -dir /app/lshelper
# copy the binary to the main app directory
RUN cp lshelperbin /
# CMD ["/lshelperbin", "-dir", "/"]
WORKDIR /app/cmd/webserver
# Build the binary.
# -mod=readonly switch is used to force failure of the build if the go.mod file needs changes to succeed.
# see https://golang.org/cmd/go/#hdr-Preliminary_module_support for more details.
# RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=readonly -v -o gogcp
RUN go build -mod=readonly -v -o gogcp
# Copy the binary to the production image from the builder stage.
RUN cp gogcp /gogcp
# Run the web service on container startup.
CMD ["/gogcp"]