-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
51 lines (41 loc) · 1.06 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
39
40
41
42
43
44
45
46
47
48
49
50
51
# Build the radicle-cloud operator
FROM golang:1.16 as builder
ARG TARGETARCH
ARG GIT_HEAD_COMMIT
ARG GIT_TAG_COMMIT
ARG GIT_LAST_TAG
ARG GIT_MODIFIED
ARG GIT_REPO
ARG BUILD_DATE
# Install deps
WORKDIR /build
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
# Copy source files
COPY main.go main.go
COPY db/ db/
COPY eth/ eth/
COPY cloud/ cloud/
COPY utils/ utils/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH GO111MODULE=on go build \
-gcflags "-N -l" \
-ldflags "-X main.GitRepo=$GIT_REPO -X main.GitTag=$GIT_LAST_TAG -X main.GitCommit=$GIT_HEAD_COMMIT -X main.GitDirty=$GIT_MODIFIED -X main.BuildTime=$BUILD_DATE" \
-o radicle-cloud
FROM ubuntu:18.04
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
# Install Ansible
RUN apt-get update && apt-get install -y \
openssh-server \
python3-pip && \
pip3 install --upgrade pip && \
pip3 install ansible
WORKDIR /
COPY --from=builder /build/radicle-cloud .
COPY ansible/ ansible/
COPY Caddyfile Caddyfile
RUN useradd --user-group --create-home --no-log-init ops
USER ops
CMD ["/radicle-cloud"]