FROM golang:1.23-bullseye AS build-env WORKDIR /usr/src/social-app ENV DEBIAN_FRONTEND=noninteractive # # Environment: node # ENV NODE_VERSION=20 ENV NVM_DIR=/usr/share/nvm # # Environment: golang # ENV GODEBUG="netdns=go" ENV GOOS="linux" ENV GOARCH="amd64" ENV CGO_ENABLED=1 ENV GOEXPERIMENT="loopvar" # # Evironment: app # # Optional app view proxy DID ARG EXPO_PUBLIC_APPVIEW_PROXY_DID # This is the commit hash that the current bundle was made from. The user can # see the commit hash in the app's settings along with the other version info. # Useful for debugging/reporting. ARG EXPO_PUBLIC_BUNDLE_IDENTIFIER ENV EXPO_PUBLIC_BUNDLE_IDENTIFIER=${EXPO_PUBLIC_BUNDLE_IDENTIFIER:-self-hosted-bluesky} # The log level for the app's logger transports ARG EXPO_PUBLIC_LOG_LEVEL ENV EXPO_PUBLIC_LOG_LEVEL=${EXPO_PUBLIC_LOG_LEVEL:-info} # # Copy everything into the container. # COPY . . # # Install NVM # Install Node # Install Yarn # Install dependencies # RUN mkdir --parents $NVM_DIR && \ wget \ --output-document=/tmp/nvm-install.sh \ https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh && \ bash /tmp/nvm-install.sh && \ \. "$NVM_DIR/nvm.sh" && \ nvm install $NODE_VERSION && \ nvm use $NODE_VERSION && \ npm install --global yarn && \ yarn && \ yarn intl:build && \ EXPO_PUBLIC_ENV=production \ EXPO_PUBLIC_BUNDLE_IDENTIFIER=$EXPO_PUBLIC_BUNDLE_IDENTIFIER \ EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H") \ EXPO_PUBLIC_APPVIEW_PROXY_DID=$EXPO_PUBLIC_APPVIEW_PROXY_DID \ EXPO_PUBLIC_LOG_LEVEL=$EXPO_PUBLIC_LOG_LEVEL \ yarn build-web # # Build the Go webserver binary # RUN cd bskyweb/ && \ go mod download && \ go mod verify && \ go build \ -v \ -trimpath \ -tags timetzdata \ -o /bskyweb \ ./cmd/bskyweb # # Build the final image. # 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", "serve"] LABEL org.opencontainers.image.source=https://github.com/bluesky-social/social-app LABEL org.opencontainers.image.description="Self-hosted Bluesky web app" LABEL org.opencontainers.image.licenses=MIT