-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile-nodemon
More file actions
48 lines (35 loc) · 1.09 KB
/
Dockerfile-nodemon
File metadata and controls
48 lines (35 loc) · 1.09 KB
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
41
42
43
44
45
46
47
48
FROM golang:1.26-alpine3.22@sha256:07e91d24f6330432729082bb580983181809e0a48f0f38ecde26868d4568c6ac AS builder
ARG APP=/app
WORKDIR ${APP}
RUN apk add --no-cache make git
# disable cgo for go build
ENV CGO_ENABLED=0
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the .git directory and restore the worktree, also handle current possible changes in go.mod and go.sum
COPY .git .git
RUN git restore --source=HEAD --worktree .
COPY go.mod .
COPY go.sum .
# Copy the necessary files for building and override the restored worktree
COPY Makefile .
COPY cmd .
COPY pkg .
COPY internal internal
RUN make build-nodemon-linux-amd64
FROM alpine:3.23@sha256:5b10f432ef3da1b8d4c7eb6c487f2f5a8f096bc91145e68878dd4a5019afde11
ARG APP=/app
ENV TZ=Etc/UTC \
APP_USER=appuser
STOPSIGNAL SIGINT
RUN addgroup -S $APP_USER \
&& adduser -S $APP_USER -G $APP_USER
RUN apk add --no-cache bind-tools
USER $APP_USER
WORKDIR ${APP}
# Considered as a default HTTP API Port, NATS embedded server port
EXPOSE 8080
EXPOSE 4222
COPY --from=builder ${APP}/build/linux-amd64/nodemon ${APP}/nodemon
ENTRYPOINT ["./nodemon"]