Highly ambitious ATProtocol AppView service and sdks

switch frontend to dockerfile, can't figure out deno compile with nix rn

Changed files
+14 -103
.github
workflows
frontend
+2 -102
.github/workflows/frontend.yml
··· 1 - name: Build and Deploy Slices Frontend 1 + name: Deploy Slices Frontend 2 2 3 3 on: 4 4 workflow_dispatch: ··· 10 10 paths: [ 'frontend/**' ] 11 11 12 12 jobs: 13 - build: 14 - runs-on: ubuntu-latest 15 - defaults: 16 - run: 17 - working-directory: frontend 18 - 19 - steps: 20 - - name: Checkout code 21 - uses: actions/checkout@v4 22 - 23 - - name: Install Nix 24 - uses: DeterminateSystems/nix-installer-action@main 25 - with: 26 - logger: pretty 27 - 28 - - name: Setup Nix cache 29 - uses: DeterminateSystems/magic-nix-cache-action@main 30 - 31 - - name: Check flake 32 - run: nix flake check --refresh 33 - 34 - - name: Build frontend 35 - run: nix build .#slice-frontend --show-trace --verbose 36 - 37 - - name: Build Docker image 38 - run: nix build .#frontendImg --show-trace --verbose 39 - 40 - - name: Load Docker image 41 - run: docker load < result 42 - 43 - - name: Inspect Docker image contents 44 - run: | 45 - echo "=== Docker image contents ===" 46 - docker run --rm slice-frontend:latest ls -la /bin/slice-frontend || echo "slice-frontend symlink not found" 47 - docker run --rm slice-frontend:latest ls -la /nix/store/*/bin/slice-frontend || echo "No slice binary in nix store" 48 - docker run --rm slice-frontend:latest file /bin/slice-frontend || echo "Cannot determine file type" 49 - docker run --rm slice-frontend:latest file /nix/store/*/bin/slice-frontend || echo "Cannot determine target file type" 50 - 51 - - name: Test Docker image 52 - run: | 53 - # Start the frontend container 54 - docker run -d --name frontend-test -p 8080:8080 \ 55 - -e API_URL=http://localhost:3000 \ 56 - -e SLICE_URI=at://did:plc:bcgltzqazw5tb6k2g3ttenbj/social.slices.slice/3lwzmbjpqxk2q \ 57 - -e OAUTH_CLIENT_ID=test-client-id \ 58 - -e OAUTH_CLIENT_SECRET=test-client-secret \ 59 - -e OAUTH_REDIRECT_URI=http://localhost:8080/callback \ 60 - -e OAUTH_AIP_BASE_URL=http://localhost:3000 \ 61 - -e SESSION_ENCRYPTION_KEY=test-session-key-32-characters-long \ 62 - slice-frontend:latest 63 - 64 - # Wait for the service to start 65 - sleep 10 66 - 67 - # Check container logs 68 - echo "Container logs:" 69 - docker logs frontend-test 70 - 71 - # Check if container is still running 72 - docker ps -a | grep frontend-test 73 - 74 - # Test the endpoint 75 - curl -f http://localhost:8080 || exit 1 76 - 77 - # Stop the test container 78 - docker stop frontend-test 79 - docker rm frontend-test 80 - 81 - - name: Save Docker image as artifact 82 - run: docker save slice-frontend:latest | gzip > frontend-image.tar.gz 83 - 84 - - name: Upload Docker image artifact 85 - uses: actions/upload-artifact@v4 86 - with: 87 - name: frontend-docker-image 88 - path: frontend/frontend-image.tar.gz 89 - retention-days: 1 90 - 91 13 deploy: 92 - # if: github.ref == 'refs/heads/main' 93 - needs: build 94 14 runs-on: ubuntu-latest 95 15 defaults: 96 16 run: ··· 100 20 - name: Checkout code 101 21 uses: actions/checkout@v4 102 22 103 - - name: Download Docker image artifact 104 - uses: actions/download-artifact@v4 105 - with: 106 - name: frontend-docker-image 107 - path: frontend/ 108 - 109 - - name: Load Docker image 110 - run: docker load < frontend-image.tar.gz 111 - 112 - - name: Tag for Fly.io 113 - run: docker tag slice-frontend:latest registry.fly.io/slices-frontend:latest 114 - 115 23 - name: Setup Fly CLI 116 24 uses: superfly/flyctl-actions/setup-flyctl@master 117 25 118 - - name: Login to Fly.io registry 119 - run: flyctl auth docker 120 - env: 121 - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} 122 - 123 - - name: Push to Fly.io registry 124 - run: docker push registry.fly.io/slices-frontend:latest 125 - 126 26 - name: Deploy to Fly.io 127 - run: flyctl deploy --image registry.fly.io/slices-frontend:latest 27 + run: flyctl deploy 128 28 env: 129 29 FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
+11
frontend/Dockerfile
··· 1 + FROM denoland/deno:2.3.3 2 + 3 + WORKDIR /app 4 + 5 + COPY . . 6 + 7 + RUN deno cache src/main.ts 8 + 9 + EXPOSE 8080 10 + 11 + CMD ["run", "-A", "--unstable-kv", "src/main.ts"]
+1 -1
frontend/fly.toml
··· 7 7 primary_region = 'sea' 8 8 9 9 [build] 10 - image = 'registry.fly.io/slices-frontend:latest' 10 + dockerfile = './Dockerfile' 11 11 12 12 [env] 13 13 PORT = '8080'