diff --git a/apps/amethyst/Dockerfile b/apps/amethyst/Dockerfile index 9bbdcbe..13565ba 100644 --- a/apps/amethyst/Dockerfile +++ b/apps/amethyst/Dockerfile @@ -1,4 +1,6 @@ FROM node:22-slim AS builder +ARG CLIENT_ADDRESS + ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable @@ -19,14 +21,33 @@ COPY packages/tsconfig/ ./packages/tsconfig/ # Copy the aqua app COPY apps/amethyst/ ./apps/amethyst/ +# Copy .env +COPY ../../.env ./apps/amethyst/.env + # Build the aqua app WORKDIR /app/apps/amethyst RUN pnpm install RUN pnpm run build:web +#create the client-json +RUN echo '{ \ + "redirect_uris": ["https://'"${CLIENT_ADDRESS}"'/auth/callback"], \ + "response_types": ["code"], \ + "grant_types": ["authorization_code", "refresh_token"], \ + "scope": "atproto transition:generic", \ + "token_endpoint_auth_method": "none", \ + "application_type": "web", \ + "client_id": "https://'"${CLIENT_ADDRESS}"'/client-metadata.json", \ + "client_name": "teal", \ + "client_uri": "https://'"${CLIENT_ADDRESS}"'", \ + "dpop_bound_access_tokens": true \ + }' > /app/client-metadata.json \ + + FROM caddy:2.1.0-alpine AS caddy EXPOSE 80 EXPOSE 443 EXPOSE 443/udp COPY /apps/amethyst/Caddyfile /etc/caddy/Caddyfile -COPY --from=builder /app/apps/amethyst/build /srv \ No newline at end of file +COPY --from=builder /app/apps/amethyst/build /srv +COPY --from=builder /app/client-metadata.json /srv/client-metadata.json \ No newline at end of file diff --git a/apps/amethyst/package.json b/apps/amethyst/package.json index 0b42458..f9a8bd3 100644 --- a/apps/amethyst/package.json +++ b/apps/amethyst/package.json @@ -9,7 +9,7 @@ "ios": "expo run:ios", "web": "expo start --web", "build": "expo export --output-dir ./build --platform all", - "build:web": "expo export --output-dir ./build --platform web", + "build:web": "expo export --output-dir ./build --platform web --clear", "test": "jest --watchAll", "lexgen": "lex gen-server ./lexicons/generated/server/ ./lexicons/src/" }, diff --git a/apps/amethyst/stores/authenticationSlice.tsx b/apps/amethyst/stores/authenticationSlice.tsx index 2565eb4..a6f1669 100644 --- a/apps/amethyst/stores/authenticationSlice.tsx +++ b/apps/amethyst/stores/authenticationSlice.tsx @@ -44,7 +44,6 @@ export const createAuthenticationSlice: StateCreator = ( ) => { // check if we have CF_PAGES_URL set. if not, use localhost const baseUrl = process.env.EXPO_PUBLIC_BASE_URL || 'http://localhost:8081'; - console.log('Using base URL:', baseUrl); const initialAuth = createOAuthClient(baseUrl, 'bsky.social'); console.log('Auth client created!'); diff --git a/compose.dev.yml b/compose.dev.yml index 215c8fe..dd90765 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -20,6 +20,8 @@ services: build: context: . dockerfile: apps/amethyst/Dockerfile + args: + - CLIENT_ADDRESS=${CLIENT_ADDRESS} ports: - "80:80" - "443:443" @@ -31,7 +33,6 @@ services: - app_network environment: CLIENT_ADDRESS: ${CLIENT_ADDRESS} - EXPO_PUBLIC_DID_WEB: ${PUBLIC_DID_WEB} postgres: image: postgres:latest container_name: postgres_db