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
| LABEL maintainer="yourname@example.com" LABEL version="1.0.0" LABEL description="This is a example of Dockerfile"
FROM gloang:latest AS builder
WORKDIR /app
COPY ./main.go ./go.mod /app
RUN go tidy && \ go build -o /app/main .
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/*
ENV DEFAULT_PORT=8080
COPY --from=builder /app/main /app COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh
RUN useradd -m -s /bin/bash www
USER www
EXPOSE 8080
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/app/main", "--default"]
|