-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
22 lines (18 loc) · 884 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Create base builder image
FROM golang:1.19.1-alpine3.16 AS builder
WORKDIR /go/src/github.com/lasthyphen/ortelius
RUN apk add --no-cache alpine-sdk bash git make gcc musl-dev linux-headers git ca-certificates g++ libstdc++
# Build app
COPY . .
RUN if [ -d "./vendor" ];then export MOD=vendor; else export MOD=mod; fi && \
GOOS=linux GOARCH=amd64 CGO_CFLAGS="-O -D__BLST_PORTABLE__" go build -mod=$MOD -o /opt/orteliusd ./cmds/orteliusd/*.go
# Create final image
FROM alpine:3.16 as execution
RUN apk add --no-cache libstdc++
VOLUME /var/log/ortelius
WORKDIR /opt
# Copy in and wire up build artifacts
COPY --from=builder /opt/orteliusd /opt/orteliusd
COPY --from=builder /go/src/github.com/lasthyphen/ortelius/docker/config.json /opt/config.json
COPY --from=builder /go/src/github.com/lasthyphen/ortelius/services/db/migrations /opt/migrations
ENTRYPOINT ["/opt/orteliusd"]