-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 657 Bytes
/
Copy pathDockerfile
File metadata and controls
34 lines (24 loc) · 657 Bytes
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
# Base image
FROM golang:1.21-alpine as builder
# Working directory
WORKDIR /Weather-app
# Copy go mod and sum file
COPY go.mod go.sum ./
# Download all the dependencies
RUN go mod download
# Copy source code from current dir to working dir
COPY . .
# Build go app
RUN go build -o main .
# 2nd Stage
FROM alpine:latest
# Set current working dir n the container
WORKDIR /root/
# Copy pre-built binary file freom the base stage
COPY --from=builder /Weather-app/main .
COPY --from=builder /Weather-app/static ./static
COPY --from=builder /Weather-app/.env .
# Expose port to external world
EXPOSE 8080
# Command to run the executable
CMD [ "./main" ]