fix: serve avatar files from node process (express.static)
Build + push avatar image / build-and-push (push) Failing after 19s
Build + push avatar image / build-and-push (push) Failing after 19s
Single-container avatar service: serve the resized files from outputDir so the frontend can GET /<md5(jid)>.jpg without a separate nginx.
This commit is contained in:
@@ -44,6 +44,12 @@ app.use(bodyParser.raw( { limit: '10mb', type: 'image/*' }));
|
|||||||
app.use(logger('dev'));
|
app.use(logger('dev'));
|
||||||
app.use(cors(corsOpts));
|
app.use(cors(corsOpts));
|
||||||
|
|
||||||
|
// Serve the resized avatar files (GET /<md5(jid)>.jpg) straight from outputDir.
|
||||||
|
// The frontend reads `${avatarServiceUrl}/${hash}.jpg`; historically an nginx
|
||||||
|
// sharing the outputDir volume did this, but serving it from the node process
|
||||||
|
// keeps the deployment a single container with one port.
|
||||||
|
app.use(express.static(outputDir));
|
||||||
|
|
||||||
// function store
|
// function store
|
||||||
function resizeAndSave(buf, jidhash) {
|
function resizeAndSave(buf, jidhash) {
|
||||||
if (resolutions.length > 0) {
|
if (resolutions.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user