-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
37 lines (30 loc) · 926 Bytes
/
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
FROM golang:alpine AS builder
WORKDIR /usr/src/terramaid
# Terraform version
ARG TERRAFORM_VERSION=1.9.2
# Install necessary dependencies
RUN apk update && apk add --no-cache \
bash \
curl \
git \
unzip
# Install Terraform
RUN <<EOF
curl -fsSL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -o terraform.zip
unzip terraform.zip
EOF
# Copy the source code and build
COPY . .
RUN <<EOF
go mod download && go mod verify
go build -v -o ./terramaid main.go
EOF
FROM alpine:3.20.3
COPY --from=builder /usr/src/terramaid/terraform /usr/local/bin/terraform
COPY --from=builder /usr/src/terramaid/terramaid /usr/local/bin/terramaid
RUN apk update && apk add --no-cache git
USER nobody
#Set the working directory for Terramaid
WORKDIR /usr/src/terramaid
# Set the entrypoint and default command
ENTRYPOINT ["/usr/local/bin/terramaid"]