forked from streamdal/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (23 loc) · 877 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
# This Dockerfile utilizes a multi-stage builds
ARG ALPINE_VERSION=3.13
FROM golang:1.16-alpine$ALPINE_VERSION AS builder
# Install necessary build tools
RUN apk --update add make bash curl git
# Switch workdir, otherwise we end up in /go (default)
WORKDIR /
# Copy everything into build container
COPY . .
# Build the application
RUN make build/linux
# Now in 2nd build stage
FROM library/alpine:$ALPINE_VERSION
# Necessary depedencies
RUN apk --update add bash curl ca-certificates && update-ca-certificates
# Copy bin, tools, scripts, migrations
COPY --from=builder /build/go-template-linux /go-template-linux
COPY --from=builder /docker-entrypoint.sh /docker-entrypoint.sh
COPY --from=builder /backends/db/migrations /migrations
COPY --from=builder /dbmate /dbmate
RUN chmod +x /dbmate && chmod +x /docker-entrypoint.sh
EXPOSE 8080
CMD ["/docker-entrypoint.sh"]