Skip to content

Commit ec9103d

Browse files
authored
Merge pull request #95 from Fexaop/master
some fixes for handling errors
2 parents 075ef14 + 7ea6d74 commit ec9103d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
FROM python:3.12-slim
23

34
RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc python3-dev
@@ -16,9 +17,8 @@ RUN poetry install
1617

1718
WORKDIR /app/src
1819

19-
WORKDIR /app/src
20+
ENV PORT=${PORT:-8000}
21+
ENV WORKERS=${WORKERS:-4}
22+
EXPOSE ${PORT}
2023

21-
EXPOSE 8000
22-
EXPOSE 8081
23-
# Run both main app and admin app
24-
CMD ["sh", "-c", "gunicorn -w 4 -k uvicorn.workers.UvicornWorker pwncore:app --bind 0.0.0.0:8000 --log-level debug"]
24+
CMD ["bash", "-c", "gunicorn -w ${WORKERS} -k uvicorn.workers.UvicornWorker pwncore:app --bind 0.0.0.0:${PORT} --log-level debug"]

src/pwncore/routes/ctf/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,12 @@ async def flag_post(
126126
return {"msg_code": config.msg_codes["db_error"]}
127127

128128
if problem.static_files:
129-
shutil.rmtree(
130-
f"{config.staticfs_data_dir}/{team_id}/{team_container.docker_id}"
131-
)
129+
try:
130+
shutil.rmtree(
131+
f"{config.staticfs_data_dir}/{team_id}/{team_container.docker_id}"
132+
)
133+
except:
134+
pass
132135
else:
133136
try:
134137
container = await containerASD.docker_client.containers.get(

src/pwncore/routes/ctf/start.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,6 @@ async def stop_docker_container(ctf_id: int, response: Response, jwt: RequireJwt
291291
except:
292292
pass
293293

294-
container = await containerASD.docker_client.containers.get(
295-
team_container.docker_id
296-
)
297294
try:
298295
container = await containerASD.docker_client.containers.get(
299296
team_container.docker_id

0 commit comments

Comments
 (0)