forked from kubev2v/migration-planner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Containerfile.agent
38 lines (27 loc) · 936 Bytes
/
Containerfile.agent
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
FROM registry.access.redhat.com/ubi9/ubi as ui
WORKDIR /app
RUN mkdir /app/www && \
curl -Lo /tmp/agent-latest.tgz https://github.com/kubev2v/migration-planner-ui/releases/download/v0.0.1-test/agent-v0.0.1-test.tgz && \
tar xf /tmp/agent-latest.tgz -C /app/www
# Builder container
FROM registry.access.redhat.com/ubi9/go-toolset as builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION
ENV VERSION=${VERSION}
USER 0
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildvcs=false \
-ldflags "-X github.com/kubev2v/migration-planner/internal/agent.version=${VERSION}" \
-o /planner-agent cmd/planner-agent/main.go
FROM registry.access.redhat.com/ubi9/ubi-micro
WORKDIR /app
COPY --from=builder /planner-agent /app/
COPY --from=ui /app/www/package/dist /app/www
# Use non-root user
RUN chown -R 1001:0 /app
USER 1001
# Run the server
EXPOSE 3333
ENTRYPOINT ["/app/planner-agent"]