-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
50 lines (34 loc) · 1.56 KB
/
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
44
45
46
47
48
49
50
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.24-alpine AS builder-www
RUN apk add --no-cache go-task curl bash libstdc++ \
&& curl -fsSL https://bun.sh/install | bash \
&& ln -s $HOME/.bun/bin/bun /usr/bin/bun
WORKDIR /build/
COPY . ./
RUN go-task install-www build-www
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.24-alpine AS builder-server
RUN apk add --no-cache go-task
WORKDIR /build/
COPY --from=builder-www /build/. ./
ARG TARGETOS
ARG TARGETARCH
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go-task install-server build-server
RUN addgroup jspaste \
&& adduser -G jspaste -u 7777 -s /bin/false -D jspaste \
&& grep jspaste /etc/passwd > /tmp/.frontend.passwd
FROM --platform=$BUILDPLATFORM scratch
COPY --from=builder-server /tmp/.frontend.passwd /etc/passwd
COPY --from=builder-server /etc/group /etc/group
WORKDIR /frontend/
COPY --chown=jspaste:jspaste --from=builder-server /build/dist/server ./
COPY --chown=jspaste:jspaste --from=builder-server /build/LICENSE ./
LABEL org.opencontainers.image.created="0001-01-01T00:00:00Z" \
org.opencontainers.image.description="The web based editor for JSPaste" \
org.opencontainers.image.licenses="EUPL-1.2" \
org.opencontainers.image.revision="unspecified" \
org.opencontainers.image.source="https://github.com/jspaste/frontend" \
org.opencontainers.image.title="jspaste-frontend" \
org.opencontainers.image.url="https://github.com/jspaste/frontend" \
org.opencontainers.image.version="unspecified"
EXPOSE 3000
USER jspaste:jspaste
ENTRYPOINT ["/frontend/server"]