This commit is contained in:
Eric Bailey
2025-01-22 17:45:12 -06:00
parent 6fb52fabcc
commit 9533aea792
3 changed files with 55 additions and 51 deletions
+17 -20
View File
@@ -1,25 +1,5 @@
# Copy this to `.env.local` and `.env.test` files
# The env the app is running in e.g. development, testflight, production
EXPO_PUBLIC_ENV=development
# App view DID
EXPO_PUBLIC_APPVIEW_DID=
# Chat service DID
EXPO_PUBLIC_CHAT_DID=
# Bitdrift
BITDRIFT_API_KEY=
# Sentry (deprecated)
SENTRY_AUTH_TOKEN=
# The log level for the app.
EXPO_PUBLIC_LOG_LEVEL=debug
# Currently unused. Enable debug for a subset of the debug logs.
EXPO_PUBLIC_LOG_DEBUG=
# 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.
@@ -28,3 +8,20 @@ EXPO_PUBLIC_BUNDLE_IDENTIFIER=
# each build. This should only be used for Statsig reporting and shouldn't be
# used to identify a specific bundle.
EXPO_PUBLIC_BUNDLE_DATE=0
# Optional app view proxy DID
EXPO_PUBLIC_APPVIEW_PROXY_DID=
# The log level for the app's logger transports
EXPO_PUBLIC_LOG_LEVEL=info
# Currently unused. Enable debug for a subset of the debug logs.
EXPO_PUBLIC_LOG_DEBUG=
#
# Bluesky specific
#
# Chat service DID
EXPO_PUBLIC_CHAT_DID=
# Bitdrift
BITDRIFT_API_KEY=
# Sentry (deprecated)
SENTRY_AUTH_TOKEN=
+36 -30
View File
@@ -1,58 +1,71 @@
FROM golang:1.23-bullseye AS build-env
WORKDIR /usr/src/social-app
ENV DEBIAN_FRONTEND=noninteractive
# Node
#
# Environment: node
#
ENV NODE_VERSION=20
ENV NVM_DIR=/usr/share/nvm
# Go
#
# Environment: golang
#
ENV GODEBUG="netdns=go"
ENV GOOS="linux"
ENV GOARCH="amd64"
ENV CGO_ENABLED=1
ENV GOEXPERIMENT="loopvar"
# App
ARG EXPO_PUBLIC_BUNDLE_IDENTIFIER
ARG EXPO_PUBLIC_APPVIEW_DID
ARG BSKYWEB_APPVIEW_HOST
ENV EXPO_PUBLIC_BUNDLE_IDENTIFIER=${EXPO_PUBLIC_BUNDLE_IDENTIFIER:-dev}
ENV BSKYWEB_APPVIEW_HOST=${BSKYWEB_APPVIEW_HOST:-https://public.api.bsky.app}
#
# 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
# Install Node and dependencies
RUN \. "$NVM_DIR/nvm.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_APPVIEW_DID=$EXPO_PUBLIC_APPVIEW_DID \
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
# Debug
RUN find ./bskyweb/static && find ./web-build/static
# Generate the bskyweb Go binary.
#
# Build the Go webserver binary
#
RUN cd bskyweb/ && \
go mod download && \
go mod verify && \
echo "GOLOG_LOG_LEVEL=info" >> .env && \
echo "ATP_APPVIEW_HOST=$BSKYWEB_APPVIEW_HOST" >> .env
RUN cd bskyweb/ && \
go build \
-v \
-trimpath \
@@ -63,24 +76,17 @@ RUN cd 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
+2 -1
View File
@@ -14,7 +14,8 @@ export const IS_INTERNAL = __DEV__ || IS_TESTFLIGHT
* The DID of the appview service to proxy to. If undefined, use Bluesky's
* default app view.
*/
export const APPVIEW_DID: Did | undefined = process.env.EXPO_PUBLIC_APPVIEW_DID
export const APPVIEW_DID: Did | undefined =
process.env.EXPO_PUBLIC_APPVIEW_PROXY_DID
/**
* The DID of the chat service to proxy to. If undefined, chat should be