You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y \
curl \
vim \
netcat \
htop \
iputils-ping \
wget
FROM alpine:3.17
RUN apk add --no-cache curl \
&& rm -rf /var/cache/apk/*
Exposing Unnecessary Ports
RUN apt-get update && apt-get install -y \
apache2
# Too many ports exposedEXPOSE 22 8080 3306 5000 80
# Only expose the necessary portEXPOSE 80
Not Using Multi-Stage Builds
FROM golang:1.19
WORKDIR /app
COPY . .
RUN go build -o myapp .
# Development tools remain in the final image (go, git)CMD ["./myapp"]
FROM golang:1.19 AS builder
WORKDIR /app
COPY . .
RUN go build -o myapp .
FROM alpine:3.17
WORKDIR /app
# Only copy the necessary artifacts from the builder image# Leave development tools behindCOPY --from=builder /app/myapp .
CMD ["./myapp"]
Not Setting Proper Permissions
COPY myapp /usr/local/bin/myapp
COPY myapp /usr/local/bin/myapp
RUN chmod 755 /usr/local/bin/myapp