Skip to content

Commit 3108ed2

Browse files
committed
fix: blacksheep-nginx-unit-build
1 parent 8382f25 commit 3108ed2

File tree

4 files changed

+40
-29
lines changed

4 files changed

+40
-29
lines changed

frameworks/Python/blacksheep/blacksheep-nginx-unit.dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ RUN pip3 install Cython==3.0.12
99
RUN pip3 install -r /blacksheep/requirements.txt
1010
RUN pip3 install -r /blacksheep/requirements-uvicorn.txt
1111

12-
COPY ./nginx-unit-config.sh /docker-entrypoint.d/
13-
12+
RUN chmod +x start-unit.sh
1413

1514
ENV PGSSLMODE=disable
1615

17-
EXPOSE 8080
16+
EXPOSE 8080
17+
CMD ["./start-unit.sh"]

frameworks/Python/blacksheep/nginx-unit-config.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
NPROC=$(nproc)
4+
sed "s/{{NPROC}}/$NPROC/" unit-config.template.json > nginx-unit-config.json
5+
6+
unitd --no-daemon --control unix:/var/run/control.unit.sock &
7+
8+
# wait UNIT started
9+
sleep 1
10+
11+
# PUT configure
12+
curl -X PUT \
13+
--data-binary @nginx-unit-config.json \
14+
--unix-socket /var/run/control.unit.sock \
15+
http://localhost/config
16+
17+
# Then keep the container alive
18+
wait
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"listeners": {
3+
"*:8080": {
4+
"pass": "applications/blacksheep"
5+
}
6+
},
7+
"applications": {
8+
"blacksheep": {
9+
"type": "python",
10+
"path": "/blacksheep",
11+
"working_directory": "/blacksheep",
12+
"protocol": "asgi",
13+
"module": "app",
14+
"callable": "app",
15+
"processes": {{NPROC}}
16+
}
17+
},
18+
"access_log": "/dev/null"
19+
}

0 commit comments

Comments
 (0)