-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
36 lines (25 loc) · 1.22 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
# --- BEGINING OF BUILDER
FROM golang:1.23.3-bookworm AS builder
WORKDIR /go/src/github.com/dohernandez/kit-template
# This is to cache the Go modules in their own Docker layer by
# using `go mod download`, so that next steps in the Docker build process
# won't need to download modules again if no modules have been updated.
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
# Install migrate
RUN curl -sL https://github.com/golang-migrate/migrate/releases/download/v4.11.0/migrate.linux-amd64.tar.gz | tar xvz \
&& mv migrate.linux-amd64 /bin/migrate
COPY . ./
# Build http binary and cli binary
RUN make build
# --- END OF BUILDER
FROM debian:bookworm
RUN groupadd -r kittemplate && useradd --no-log-init -r -g kittemplate kittemplate
USER kittemplate
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder --chown=kittemplate:kittemplate /go/src/github.com/dohernandez/kit-template/bin/kit-template /bin/kit-template
COPY --from=builder --chown=kittemplate:kittemplate /go/src/github.com/dohernandez/kit-template/resources/migrations /resources/migrations
COPY --from=builder --chown=kittemplate:kittemplate /bin/migrate /bin/migrate
EXPOSE 8000 8080 8010
ENTRYPOINT ["kit-template"]