-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (30 loc) · 952 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
38
FROM golang:1.23-alpine
# Install required packages
RUN apk add --no-cache \
git \
curl \
unzip \
docker-cli \
aws-cli \
bash \
docker
# Install Terraform
RUN curl -fsSL https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip -o terraform.zip && \
unzip terraform.zip && \
mv terraform /usr/local/bin/ && \
rm terraform.zip
# Install Trivy (Vulnerability Scanner)
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
# Set working directory
WORKDIR /go/src/app
# Copy application files
COPY . .
# Ensure entrypoint.sh is copied and executable
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
# Build the Go application
RUN go build -o smurf main.go && \
mv smurf /usr/local/bin/ && \
chmod +x /usr/local/bin/smurf
# Set the entrypoint
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]