-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
45 lines (31 loc) · 1.17 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
FROM golang:1.21 as builder
ARG version
ENV VERSION_VAR=go.qbee.io/agent/app.Version
ENV CGO_ENABLED=0
WORKDIR /src
COPY . /src
# build the agent
RUN --mount=type=cache,target=/go \
--mount=type=cache,target=/root/.cache/go-build \
go build \
-ldflags "-s -w -X ${VERSION_VAR}=$version" \
-o /usr/sbin/qbee-agent \
main.go
FROM debian:stable
ARG version
# add qbee-dev apt repo
COPY app/software/test_repository/debian /apt-repo
RUN echo "deb [trusted=yes] file:/apt-repo ./" > /etc/apt/sources.list.d/qbee-dev.list
# Install ca-certificates in latest version
RUN apt-get update && apt-get install -y ca-certificates curl
# add docker repo, so we can install it when needed (disable auth)
RUN echo 'Acquire::https { Verify-Peer "false" }' > /etc/apt/apt.conf.d/99verify-peer.conf
RUN echo "deb [trusted=yes] http://download.docker.com/linux/debian bullseye stable" \
> /etc/apt/sources.list.d/docker.list
# update apt cache
RUN apt-get update && apt-get upgrade -y
# create empty agent configuration directory
RUN mkdir /etc/qbee && echo '{}' > /etc/qbee/qbee-agent.json
WORKDIR /app
# copy the agent
COPY --from=builder /usr/sbin/qbee-agent /usr/sbin/qbee-agent