-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
38 lines (32 loc) · 1.13 KB
/
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
38
# This Dockerfile builds a tiny little image to ship the Inertia daemon in.
### Setting up daemon build dependencies
FROM golang:alpine AS daemon-build
ARG INERTIA_VERSION
ENV BUILD_HOME=/go/src/github.com/ubclaunchpad/inertia \
INERTIA_VERSION=${INERTIA_VERSION}
WORKDIR ${BUILD_HOME}
# Install dependencies and cache them
RUN apk add --update --no-cache git=2.26.2-r0
COPY go.mod .
COPY go.sum .
RUN go mod download
# Mount source code
COPY . .
# Build daemon binary.
RUN go build -o /bin/inertiad \
-ldflags "-w -s -X main.Version=$INERTIA_VERSION" \
./daemon/inertiad
### Copy builds into combined image for distribution in a smaller image
FROM alpine:3.12
LABEL maintainer "UBC Launch Pad [email protected]"
RUN mkdir -p /daemon
WORKDIR /daemon
COPY --from=daemon-build /bin/inertiad /usr/local/bin
# Directories
ENV INERTIA_PROJECT_DIR=/app/host/inertia/project/ \
INERTIA_DATA_DIR=/app/host/inertia/data/ \
INERTIA_PERSIST_DIR=/app/host/inertia/persist \
INERTIA_SECRETS_DIR=/app/host/.inertia/ \
INERTIA_GH_KEY_PATH=/app/host/.ssh/id_rsa_inertia_deploy
# Serve the daemon by default.
ENTRYPOINT ["inertiad", "run"]