mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1FROM golang:1.21-bullseye AS build-env
2
3WORKDIR /usr/src/social-app
4
5ENV DEBIAN_FRONTEND=noninteractive
6
7# Node
8ENV NODE_VERSION=18
9ENV NVM_DIR=/usr/share/nvm
10
11# Go
12ENV GODEBUG="netdns=go"
13ENV GOOS="linux"
14ENV GOARCH="amd64"
15ENV CGO_ENABLED=1
16ENV GOEXPERIMENT="loopvar"
17
18COPY . .
19
20#
21# Generate the JavaScript webpack.
22#
23RUN mkdir --parents $NVM_DIR && \
24 wget \
25 --output-document=/tmp/nvm-install.sh \
26 https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh && \
27 bash /tmp/nvm-install.sh
28
29RUN \. "$NVM_DIR/nvm.sh" && \
30 nvm install $NODE_VERSION && \
31 nvm use $NODE_VERSION && \
32 npm install --global yarn && \
33 yarn && \
34 yarn intl:build && \
35 yarn build-web
36
37# DEBUG
38RUN find ./bskyweb/static && find ./web-build/static
39
40#
41# Generate the bskyweb Go binary.
42#
43RUN cd bskyweb/ && \
44 go mod download && \
45 go mod verify
46
47RUN cd bskyweb/ && \
48 go build \
49 -v \
50 -trimpath \
51 -tags timetzdata \
52 -o /bskyweb \
53 ./cmd/bskyweb
54
55FROM debian:bullseye-slim
56
57ENV GODEBUG=netdns=go
58ENV TZ=Etc/UTC
59ENV DEBIAN_FRONTEND=noninteractive
60
61RUN apt-get update && apt-get install --yes \
62 dumb-init \
63 ca-certificates
64
65ENTRYPOINT ["dumb-init", "--"]
66
67WORKDIR /bskyweb
68COPY --from=build-env /bskyweb /usr/bin/bskyweb
69
70CMD ["/usr/bin/bskyweb"]
71
72LABEL org.opencontainers.image.source=https://github.com/bluesky-social/social-app
73LABEL org.opencontainers.image.description="bsky.app Web App"
74LABEL org.opencontainers.image.licenses=MIT