Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker containerization and README improvings #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sample
run-container.sh
src/main.ts
tsconfig.json
README.md
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:23-slim

WORKDIR /app
COPY . .

RUN apt-get update && \
apt-get install -y pandoc && \
npm install --production && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["./run-local.sh"]
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,30 @@

```bash
git clone https://github.com/ispras/proceedings-md
cd proceedings
cd proceedings-md
npm install
sudo apt-get install pandoc
```

Файл `sample.md` содержит стандартный шаблон статьи для Трудов ИСП РАН,
Файл `sample/sample.md` содержит стандартный шаблон статьи для Трудов ИСП РАН,
представленный в `.md`-формате. Скрипт `src/main.js` выполняет конвертацию.

```
cd sample
node ../src/main.js sample.md sample.docx
node src/main.js sample/sample.md sample/sample.docx
````

Если вы хотите использовать конвертер в контейнере, необходимо выполнить
следующие команды:
```
docker build -t proceedings-md .
./run-container.sh proceedings-md sample/sample.md sample/sample.docx
```

## Notes

Скрипт несколько сырой. Ошибки могут быть нечитаемыми. Некоторые версии Microsoft Word
ругаются на то, что документ повреждён, но все равно открывают его. Перед отправкой
документа рекомендуется открыть документ в Word, перепроверить форматирование, и сохранить
заново.

Happy researching!
Happy researching!
11 changes: 11 additions & 0 deletions run-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

container_name="$1"
input="$2"
output="$3"

docker run --rm -v "$(dirname "$input")":/input \
-v "$(dirname "$output")":/output \
"$container_name" \
/input/"$(basename "$input")" \
/output/"$(basename "$output")"
6 changes: 6 additions & 0 deletions run-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

input="$1"
output="$2"

node "$(dirname "$0")"/src/main.js "$input" "$output"