2023-08-29 04:35:23 +02:00
|
|
|
FROM golang:1.21-bullseye AS build-env
|
2023-03-20 22:41:15 +01:00
|
|
|
|
|
|
|
WORKDIR /usr/src/social-app
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
# Node
|
|
|
|
ENV NODE_VERSION=18
|
|
|
|
ENV NVM_DIR=/usr/share/nvm
|
|
|
|
|
|
|
|
# Go
|
|
|
|
ENV GODEBUG="netdns=go"
|
|
|
|
ENV GOOS="linux"
|
|
|
|
ENV GOARCH="amd64"
|
|
|
|
ENV CGO_ENABLED=1
|
2023-08-29 04:35:23 +02:00
|
|
|
ENV GOEXPERIMENT="loopvar"
|
2023-03-20 22:41:15 +01:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
#
|
2023-05-30 21:46:43 +02:00
|
|
|
# Generate the JavaScript webpack.
|
2023-03-20 22:41:15 +01:00
|
|
|
#
|
|
|
|
RUN mkdir --parents $NVM_DIR && \
|
|
|
|
wget \
|
|
|
|
--output-document=/tmp/nvm-install.sh \
|
2024-02-27 02:35:06 +01:00
|
|
|
https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh && \
|
2023-03-20 22:41:15 +01:00
|
|
|
bash /tmp/nvm-install.sh
|
|
|
|
|
|
|
|
RUN \. "$NVM_DIR/nvm.sh" && \
|
|
|
|
nvm install $NODE_VERSION && \
|
|
|
|
nvm use $NODE_VERSION && \
|
|
|
|
npm install --global yarn && \
|
|
|
|
yarn && \
|
2024-03-06 21:27:49 +01:00
|
|
|
yarn intl:build && \
|
2024-04-12 17:14:20 +02:00
|
|
|
yarn build-web
|
2023-03-20 22:41:15 +01:00
|
|
|
|
|
|
|
# DEBUG
|
|
|
|
RUN find ./bskyweb/static && find ./web-build/static
|
|
|
|
|
|
|
|
#
|
2023-05-30 21:46:43 +02:00
|
|
|
# Generate the bskyweb Go binary.
|
2023-03-20 22:41:15 +01:00
|
|
|
#
|
|
|
|
RUN cd bskyweb/ && \
|
|
|
|
go mod download && \
|
|
|
|
go mod verify
|
|
|
|
|
|
|
|
RUN cd bskyweb/ && \
|
|
|
|
go build \
|
|
|
|
-v \
|
|
|
|
-trimpath \
|
|
|
|
-tags timetzdata \
|
|
|
|
-o /bskyweb \
|
|
|
|
./cmd/bskyweb
|
|
|
|
|
|
|
|
FROM debian:bullseye-slim
|
|
|
|
|
|
|
|
ENV GODEBUG=netdns=go
|
|
|
|
ENV TZ=Etc/UTC
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install --yes \
|
|
|
|
dumb-init \
|
|
|
|
ca-certificates
|
|
|
|
|
|
|
|
ENTRYPOINT ["dumb-init", "--"]
|
|
|
|
|
|
|
|
WORKDIR /bskyweb
|
|
|
|
COPY --from=build-env /bskyweb /usr/bin/bskyweb
|
|
|
|
|
|
|
|
CMD ["/usr/bin/bskyweb"]
|
|
|
|
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/bluesky-social/social-app
|
|
|
|
LABEL org.opencontainers.image.description="bsky.app Web App"
|
|
|
|
LABEL org.opencontainers.image.licenses=MIT
|