Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Only publish /dist files #51

Merged
merged 4 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/eleven-donkeys-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@xmtp/experimental-content-type-screen-effect": patch
"@xmtp/content-type-reaction": patch
"@xmtp/content-type-read-receipt": patch
"@xmtp/content-type-remote-attachment": patch
"@xmtp/content-type-reply": patch
"@xmtp/content-type-transaction-reference": patch
---

Only publish files in the `/dist` directory
13 changes: 2 additions & 11 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ services:
POSTGRES_PASSWORD: xmtp

upload-service:
build: ./upload-service
build: ./uploadService
ports:
- 4567:4567

caddy:
image: caddy:latest
ports:
- "443:443"
volumes:
- ./upload-service/Caddyfile:/etc/caddy/Caddyfile
- ./upload-service/data/data:/data
- ./upload-service/data/config:/config
- 3000:3000
4 changes: 0 additions & 4 deletions dev/upload-service/Caddyfile

This file was deleted.

7 changes: 0 additions & 7 deletions dev/upload-service/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions dev/upload-service/app.rb

This file was deleted.

15 changes: 15 additions & 0 deletions dev/uploadService/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fetching the minified node image on apline linux
FROM node:18.19-slim

WORKDIR /uploadService
COPY . .

RUN apt-get update && \
apt-get install -y openssl && \
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -sha256 -days 3650 -subj /CN=localhost -out cert.pem

RUN npm install

CMD ["node", "index.js"]

EXPOSE 3000
36 changes: 36 additions & 0 deletions dev/uploadService/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const fs = require("fs");
const https = require("https");
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
const port = 3000;

const key = fs.readFileSync("key.pem", "utf-8");
const cert = fs.readFileSync("cert.pem", "utf-8");

const UPLOADS = {};

app.use(bodyParser.raw({ type: "application/octet-stream" }));

app.get("/:path", (req, res) => {
const path = req.params.path;
console.log(`GET /${path}`);
const file = UPLOADS[path];
if (file) {
res.header("Content-Type", "application/octet-stream");
res.send(file);
} else {
console.log(`Upload path found: ${path}`);
}
});

app.post("/:path", (req, res) => {
const path = req.params.path;
console.log(`POST /${path}`);
UPLOADS[path] = req.body;
res.sendStatus(200);
});

https.createServer({ key, cert }, app).listen(port, () => {
console.log(`Upload service listening on port ${port}`);
});
Loading