-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 784 Bytes
/
Copy pathDockerfile
File metadata and controls
37 lines (27 loc) · 784 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
FROM golang:1.22-alpine3.19 AS builder
LABEL org.opencontainers.image.source="https://github.com/v1k45/pastepass"
# go mod cache layer
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
ARG VERSION=0.00-dev
RUN CGO_ENABLED=0 go build -o /out/pastepass -ldflags "-X 'github.com/v1k45/pastepass/config.Version=$VERSION'"
FROM alpine:3.19
ENV USER=pastepass
ENV UID=1000
ENV GID=1000
ENV APP_DIR=/app
ENV DATA_DIR=/data
RUN apk add --no-cache tini ca-certificates \
&& addgroup -g $GID -S $USER \
&& adduser -u $UID -S -G $USER $USER
WORKDIR $APP_DIR
COPY --from=builder /out/pastepass .
ENV PATH=$APP_DIR:$PATH
RUN mkdir -p $DATA_DIR && chown $UID:$GID $DATA_DIR
WORKDIR $DATA_DIR
USER $USER
EXPOSE 8008
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["pastepass"]