-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 850 Bytes
/
Dockerfile
File metadata and controls
39 lines (26 loc) · 850 Bytes
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
FROM golang:1.22-alpine AS builder
ARG GIT_URL
ARG BUILD_CMD="go build -tags netgo -ldflags '-s -w' -o app"
ENV GIT_URL=${GIT_URL}
ENV BUILD_CMD=${BUILD_CMD}
RUN apk add --no-cache git
WORKDIR /app
RUN git clone ${GIT_URL} .
RUN echo "#!/bin/sh" >> build.sh && echo -n "${BUILD_CMD}" >> build.sh && chmod +x build.sh
RUN ./build.sh
###########################<<<<<<<<<<>>>>>>>>>>>###########################
FROM alpine:latest
ARG START_CMD="./app"
ENV START_CMD=${START_CMD}
ARG PORT="8080"
ENV PORT=${PORT}
ARG EXEC_NAME
ENV EXEC_NAME=${EXEC_NAME}
WORKDIR /root/
COPY --from=builder /app/${EXEC_NAME} .
EXPOSE ${PORT}
RUN echo "#!/bin/sh" >> run.sh && echo -n "${START_CMD}" >> run.sh && chmod +x run.sh
RUN chmod +x run.sh
# ENTRYPOINT ["tail"]
# CMD [ "-f", "/dev/null"]
ENTRYPOINT ["./run.sh"]