-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (29 loc) · 885 Bytes
/
Dockerfile
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
FROM golang:1.22 AS build
WORKDIR /app
# Retrieve application dependencies.
# This allows the container build to reuse cached dependencies.
# Expecting to copy go.mod and if present go.sum.
COPY go.* ./
RUN go mod download
# Copy local code to the container image.
COPY . ./
# Build the binary.
RUN go build -v -o bin/miniscrape
FROM debian:stable-slim
# Create a non-root user.
RUN adduser -u 1000 --system --group --no-create-home user
# Install curl for healthcheck.
RUN apt update && \
apt install -y curl && \
apt clean && \
rm -rf /var/lib/apt/lists/*
# Change the working directory.
WORKDIR /app
RUN chown -R user:user /app
# Use an unprivileged user.
USER user
COPY --chown=user:user --from=build /app/bin ./bin
COPY --chown=user:user --from=build /app/config ./config
RUN mkdir -p /app/runtime
EXPOSE 8080
ENTRYPOINT ["/app/bin/miniscrape", "serve"]