-
Notifications
You must be signed in to change notification settings - Fork 97
/
Dockerfile.dev
44 lines (28 loc) · 1.3 KB
/
Dockerfile.dev
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
ARG GOLANG_IMAGE=golang:1.21.5-alpine3.19@sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b
ARG GOLANGCI_LINT_IMAGE=golangci/golangci-lint:latest@sha256:e699df940be1810b08ba6ec050bfc34cc1931027283b5a7f607fb6a67b503876
ARG PACKER_IMAGE=hashicorp/packer:1.10@sha256:1deccbc7bca80cccfc50218e269f87db33476fda79de814372db608715d000c0
ARG TERRAFORM_IMAGE=hashicorp/terraform:1.6@sha256:9a42ea97ea25b363f4c65be25b9ca52b1e511ea5bf7d56050a506ad2daa7af9d
ARG UBUNTU_IMAGE=ubuntu:mantic@sha256:cbc171ba52575fec0601f01abf6fdec67f8ed227658cacbc10d778ac3b218307
FROM ${GOLANGCI_LINT_IMAGE}
WORKDIR /app
COPY . .
RUN /usr/bin/golangci-lint run -v -c .golangci.yml
FROM ${GOLANG_IMAGE} as BUILDER
WORKDIR /build
COPY go.* ./
RUN go mod download
COPY . ./
RUN go build -v -o /simulator cmd/container/main.go
FROM ${PACKER_IMAGE} as PACKER
FROM ${TERRAFORM_IMAGE} as TERRAFORM
FROM ${UBUNTU_IMAGE}
WORKDIR /simulator
COPY --from=PACKER /bin/packer /usr/local/bin/packer
COPY --from=TERRAFORM /bin/terraform /usr/local/bin/terraform
RUN apt update && \
apt install -y ca-certificates openssh-client ansible-core && \
rm -rf /var/lib/apt/lists/* && \
ansible-galaxy collection install kubernetes.core
COPY --from=BUILDER /simulator /usr/local/bin/simulator
USER ubuntu
ENTRYPOINT ["/usr/local/bin/simulator"]