forked from speakeasy-api/rest-template-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (19 loc) · 559 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
# syntax=docker/dockerfile:1
# Build a golang image based on https://docs.docker.com/language/golang/build-images
FROM golang:1.18-alpine AS build
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY ./cmd/server/main.go ./cmd/server/main.go
COPY ./internal/ ./internal/
RUN go build -o ./server ./cmd/server/main.go
# Build the server image
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /app/server ./
COPY ./config/ ./config/
COPY ./migrations/ ./migrations/
EXPOSE 8080
CMD ["./server"]