Compare commits
7
Commits
7218004f2f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c19fc58a25 | ||
|
|
bd5dc8fbc4 | ||
|
|
f4a81b4b9b | ||
|
|
477389d353 | ||
|
|
90a44e8b6e | ||
|
|
36d2233567 | ||
|
|
2fc979a845 |
+13
-4
@@ -24,10 +24,12 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requir
|
||||
# pull official base image
|
||||
FROM dvcorg/cml:0-dvc2-base1-gpu
|
||||
|
||||
# create app home
|
||||
ENV APP_HOME = /home/app
|
||||
RUN mkdir -p $APP_HOME
|
||||
WORKDIR $APP_HOME
|
||||
# create home directory and app user
|
||||
RUN mkdir -p /home/app && \
|
||||
addgroup --system app && \
|
||||
adduser --system --group app
|
||||
|
||||
# add folder to store repo in
|
||||
RUN mkdir -p /home/app/repo
|
||||
|
||||
# install packages from builder
|
||||
@@ -36,7 +38,14 @@ COPY --from=builder /usr/src/app/requirements.txt requirements.txt
|
||||
RUN pip install --no-cache /wheels/*
|
||||
|
||||
# copy in files
|
||||
WORKDIR /home/app
|
||||
COPY ./code .
|
||||
|
||||
# change ownership to app user
|
||||
RUN chown -R app:app /home/app
|
||||
|
||||
# change to the app user
|
||||
USER app
|
||||
|
||||
# start execution
|
||||
ENTRYPOINT [ "python", "main.py" ]
|
||||
+7
-2
@@ -79,8 +79,13 @@ def handle_event(request: GiteaRequest):
|
||||
requirements_path = local_repo_dir / pipeline.requirements
|
||||
os.system(f'pip install -r {requirements_path}')
|
||||
for cmd in pipeline.script:
|
||||
print(cmd)
|
||||
|
||||
try:
|
||||
os.system(cmd)
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=503,
|
||||
detail=f'failed running {cmd}: {e}'
|
||||
)
|
||||
# send response
|
||||
raise HTTPException(
|
||||
status_code=202,
|
||||
|
||||
+8
-1
@@ -10,4 +10,11 @@ services:
|
||||
- LOGGER_LEVEL=debug
|
||||
- LISTEN_IP=0.0.0.0
|
||||
- LISTEN_PORT=8000
|
||||
- REPO_DIR=/home/app/repo/
|
||||
- REPO_DIR=/home/app/repo/
|
||||
# deploy:
|
||||
# resources:
|
||||
# reservations:
|
||||
# devices:
|
||||
# - driver: nvidia
|
||||
# device_ids: ['0']
|
||||
# capabilities: [gpu]
|
||||
+1
-1
@@ -4,7 +4,7 @@ definitions:
|
||||
name: test
|
||||
requirements: req-prod.txt
|
||||
script:
|
||||
- echo nvidia-smi
|
||||
- nvidia-smi
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user