Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update dockerfile to add node and prettier
  • Loading branch information
adqm committed Sep 20, 2025
commit 0e7c32b75d0f5a3cb256095fa3d08f5ee70ce65e
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ RUN apt-get update && apt-get install -y \
git \
sqlite3 \
ssh \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*

## Install pipenv
Expand All @@ -56,6 +58,10 @@ WORKDIR /home/cc
USER cc:cc
RUN mkdir .ssh && chmod 0700 .ssh

# Set up our node environment
RUN npm install express prettier
COPY prettier-server.js .

# Configure git for tests
RUN git config --global user.email 'app@docker-container' \
&& git config --global user.name 'App DockerContainer' \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:

app:
build: .
command: "./manage.py runserver 0.0.0.0:${PORT_APP}"
command: "bash -c 'node prettier-server.js & ./manage.py runserver 0.0.0.0:${PORT_APP}'"
environment:
- DJANGO_SETTINGS_MODULE=${DOCKER_DJANGO_SETTINGS_MODULE}
ports:
Expand Down
21 changes: 21 additions & 0 deletions prettier-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const express = require("express");
const prettier = require("prettier");

const app = express();

app.use(express.text({ limit: "10mb", type: "*/*" }));

app.post("/", async (req, res) => {
try {
const formatted = await prettier.format(req.body, { parser: "html" });
res.type("text/html").send(formatted);
} catch (error) {
res.status(500).type("text/plain").send(`Prettier error: ${error.message}`);
}
});

const server = app.listen(3000);

process.on("SIGINT", () => {
server.close(() => process.exit(0));
});