-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
37 lines (25 loc) · 888 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
# Start from golang base image
FROM golang:1.20 as builder
# Working directory
WORKDIR /
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies
RUN go mod download
# Copy everythings
COPY . .
# Build the Go app
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -o main cmd/main.go
# Start a new stage from scratch
FROM debian:stable
# RUN apk --no-cache add tzdata
WORKDIR /root/
# Copy the Pre-built binary file from the previous stage. Also copy config yml file
# COPY --from=builder .env .
COPY --from=builder main .
COPY --from=builder Makefile .
COPY --from=builder assets/ assets/
RUN apt update -y && apt install ca-certificates make curl -y && curl -L https://github.com/golang-migrate/migrate/releases/download/v4.15.2/migrate.linux-amd64.tar.gz | tar xz -- migrate
# COPY --from=builder /app/VERSION .
EXPOSE 8000
ENTRYPOINT [ "./main" ]