diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f14b292 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +server/node_modules +proton-bridge/node_modules +node_modules diff --git a/README.md b/README.md index d363559..5f9d0e6 100644 --- a/README.md +++ b/README.md @@ -112,10 +112,22 @@ Your phone will now receive Signal notifications when ProtonMail receives new em ### Development -For local development, use the dev compose file to build from source: +For local development, install Bun and signal-cli: ```bash -docker compose -f docker-compose.dev.yml up -d +# Install Bun (use your package manager and this is a backup) +curl -fsSL https://bun.sh/install | bash + +git clone https://github.com/lone-cloud/sup.git +cd sup + +bun install +``` + +Then build and run with docker-compose.dev.yml: + +```bash +docker compose -f docker-compose.dev.yml --profile protonmail up -d ``` Or run services directly with Bun: diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 5675109..86938a6 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,6 +1,8 @@ services: sup-server: - build: ./server + build: + context: . + dockerfile: server/Dockerfile ports: - '8080:8080' environment: diff --git a/scripts/release-docker.ts b/scripts/release-docker.ts index 05afebc..1c25f12 100644 --- a/scripts/release-docker.ts +++ b/scripts/release-docker.ts @@ -16,7 +16,6 @@ const config = : { name: 'sup-proton-bridge', path: './proton-bridge' }; try { - // Read version from package.json const packageJson = await Bun.file(`${config.path}/package.json`).json(); const version = `v${packageJson.version}`; diff --git a/server/Dockerfile b/server/Dockerfile index 1bb4d34..2616347 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -2,19 +2,25 @@ FROM oven/bun:1.1.42-alpine AS builder WORKDIR /app -COPY package.json bun.lock* ./ +COPY server/package.json server/bun.lock* ./ RUN bun install --frozen-lockfile -COPY . . +COPY server . -RUN bun build --compile src/server.ts --outfile sup-server +RUN bun build --compile index.ts --outfile sup-server FROM alpine:3.21 -RUN apk add --no-cache openjdk21-jre +ARG SIGNAL_CLI_VERSION=0.13.22 + +RUN apk add --no-cache openjdk21-jre curl libstdc++ libgcc + +RUN curl -L https://github.com/AsamK/signal-cli/releases/download/v${SIGNAL_CLI_VERSION}/signal-cli-${SIGNAL_CLI_VERSION}.tar.gz | tar xz -C /tmp \ + && mv /tmp/signal-cli-${SIGNAL_CLI_VERSION} /usr/local/signal-cli COPY --from=builder /app/sup-server /usr/local/bin/sup-server -COPY --from=builder /app/signal-cli /usr/local/bin/signal-cli + +ENV PATH="/usr/local/signal-cli/bin:${PATH}" EXPOSE 8080 diff --git a/server/package.json b/server/package.json index 9e11f02..d5301ad 100644 --- a/server/package.json +++ b/server/package.json @@ -10,6 +10,7 @@ "chalk": "^5.6.2" }, "scripts": { + "postinstall": "bun run ../scripts/install-signal-cli.ts || true", "dev": "bun --watch index.ts", "start": "bun run index.ts", "build": "bun build --compile index.ts --outfile sup-server",