Spaces:
Runtime error
Runtime error
Laura Cabayol Garcia
commited on
Commit
·
544a3ec
1
Parent(s):
fec263e
deploying docs and docker
Browse files- .github/workflows/deploy_docs.yml +20 -43
- Dockerfile +15 -18
.github/workflows/deploy_docs.yml
CHANGED
@@ -1,53 +1,30 @@
|
|
1 |
-
name:
|
2 |
-
|
3 |
on:
|
4 |
-
workflow_dispatch: # Allow manual triggers
|
5 |
push:
|
6 |
-
tags-ignore:
|
7 |
-
- '**' # Ignore any tags here
|
8 |
branches:
|
9 |
-
- main
|
10 |
- master
|
11 |
-
#
|
12 |
-
# Trigger when either files in the docs folder,
|
13 |
-
# the requirements.txt file or the mkdocs.yml file
|
14 |
-
# are edited and commited.
|
15 |
-
#paths:
|
16 |
-
# - 'docs/**'
|
17 |
-
# These permissions are required for it to work
|
18 |
permissions:
|
19 |
-
contents:
|
20 |
-
pages: write
|
21 |
-
# Makes sure only one workflow runs at a time.
|
22 |
-
concurrency:
|
23 |
-
group: 'pages'
|
24 |
-
cancel-in-progress: false
|
25 |
-
|
26 |
jobs:
|
27 |
-
|
28 |
runs-on: ubuntu-latest
|
29 |
-
# This environment is required!
|
30 |
-
environment:
|
31 |
-
name: github-pages
|
32 |
-
url: ${{ steps.deployment.outputs.pages_url }}
|
33 |
steps:
|
34 |
-
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
with:
|
41 |
-
|
42 |
-
-
|
43 |
-
|
44 |
-
- name: Configure GitHub Pages
|
45 |
-
# I have no idea if this actually needed...
|
46 |
-
uses: actions/configure-pages@v3
|
47 |
-
- name: Upload artifact
|
48 |
-
uses: actions/upload-pages-artifact@v2
|
49 |
with:
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
name: deploy_docs
|
|
|
2 |
on:
|
|
|
3 |
push:
|
|
|
|
|
4 |
branches:
|
|
|
5 |
- master
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
permissions:
|
7 |
+
contents: write
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
jobs:
|
9 |
+
deploy:
|
10 |
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
11 |
steps:
|
12 |
+
- uses: actions/checkout@v4
|
13 |
+
- name: Configure Git Credentials
|
14 |
+
run: |
|
15 |
+
git config user.name github-actions[bot]
|
16 |
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
17 |
+
- uses: actions/setup-python@v5
|
18 |
with:
|
19 |
+
python-version: 3.x
|
20 |
+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
21 |
+
- uses: actions/cache@v4
|
|
|
|
|
|
|
|
|
|
|
22 |
with:
|
23 |
+
key: mkdocs-material-${{ env.cache_id }}
|
24 |
+
path: .cache
|
25 |
+
restore-keys: |
|
26 |
+
mkdocs-material-
|
27 |
+
- run: pip install mkdocs-material
|
28 |
+
- name: Build and Deploy Documentation
|
29 |
+
working-directory: docs
|
30 |
+
run: mkdocs gh-deploy --force
|
Dockerfile
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
|
2 |
-
FROM python:3.10
|
3 |
|
4 |
# Set up a new user named "user" with user ID 1000
|
5 |
RUN useradd -m -u 1000 user
|
@@ -7,8 +6,11 @@ RUN useradd -m -u 1000 user
|
|
7 |
ENV HOME=/home/user \
|
8 |
PATH=/home/user/.local/bin:$PATH
|
9 |
|
10 |
-
# Install
|
11 |
-
RUN apt-get update && apt-get
|
|
|
|
|
|
|
12 |
|
13 |
# Switch to the "user" user
|
14 |
USER user
|
@@ -16,22 +18,17 @@ USER user
|
|
16 |
# Set the working directory to the user's app directory
|
17 |
WORKDIR $HOME/app
|
18 |
|
19 |
-
# Copy
|
20 |
-
COPY --chown=user .
|
21 |
|
22 |
-
# Install the
|
23 |
-
RUN pip install --
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
|
28 |
-
#
|
29 |
-
COPY --chown=user data/models/modelZ_DA.pt $HOME/app/models/
|
30 |
-
COPY --chown=user data/models/modelF_DA.pt $HOME/app/models/
|
31 |
-
|
32 |
-
# Expose the port the app runs on (if needed)
|
33 |
EXPOSE 7860
|
34 |
|
35 |
-
# Set the command to run your app
|
36 |
-
CMD ["python", "app.py", "--port", "7860", "--server-
|
37 |
-
|
|
|
1 |
+
ROM python:3.9-slim
|
|
|
2 |
|
3 |
# Set up a new user named "user" with user ID 1000
|
4 |
RUN useradd -m -u 1000 user
|
|
|
6 |
ENV HOME=/home/user \
|
7 |
PATH=/home/user/.local/bin:$PATH
|
8 |
|
9 |
+
# Install build dependencies
|
10 |
+
RUN apt-get update && apt-get install -y \
|
11 |
+
build-essential \
|
12 |
+
git \
|
13 |
+
&& rm -rf /var/lib/apt/lists/*
|
14 |
|
15 |
# Switch to the "user" user
|
16 |
USER user
|
|
|
18 |
# Set the working directory to the user's app directory
|
19 |
WORKDIR $HOME/app
|
20 |
|
21 |
+
# Copy pyproject.toml first, setting the owner to the user
|
22 |
+
COPY --chown=user pyproject.toml .
|
23 |
|
24 |
+
# Install the project and its dependencies
|
25 |
+
RUN pip install --no-cache-dir .
|
26 |
|
27 |
+
# Copy the rest of the application
|
28 |
+
COPY --chown=user . .
|
29 |
|
30 |
+
# Expose the port
|
|
|
|
|
|
|
|
|
31 |
EXPOSE 7860
|
32 |
|
33 |
+
# Set the command to run your app
|
34 |
+
CMD ["python", "app.py", "--server-port", "7860", "--server-address", "0.0.0.0"]
|
|