-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:wmgeolab/scope
- Loading branch information
Showing
4 changed files
with
163 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build Backend Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- "backend/" | ||
- "backend/scopeBackend" | ||
pull_request: | ||
branches: | ||
- master | ||
- "backend/" | ||
- "backend/scopeBackend" | ||
# these path settings ensure this workflow only executes on a push | ||
# to this YML itself, or any file in the backend or scopeBackend folders | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# GitHub sets up this token for you | ||
|
||
- name: Create db_config.cnf | ||
run: echo "${{ secrets.DB_CONFIG }}" > ./backend/db_config.cnf | ||
|
||
- name: Build and push the Docker image | ||
run: docker build -t ghcr.io/${{ github.repository_owner }}/backend:latest ./backend | ||
|
||
- name: Push the Docker image | ||
run: docker push ghcr.io/${{ github.repository_owner }}/backend:latest | ||
|
||
- name: Delete db_config.cnf | ||
run: rm ./backend/db_config.cnf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
|
||
FROM docker.io/library/python:3.11-slim | ||
|
||
EXPOSE 8000 | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
|
||
# FIRST: Copy the db_config.cnf from the scope/ folder into the scope/backend/ folder. | ||
COPY ./db_config.cnf / | ||
WORKDIR /app | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN groupadd app -g 1000 \ | ||
&& useradd -m -u 1000 -g app app \ | ||
&& apt-get update \ | ||
&& apt-get install -y default-libmysqlclient-dev build-essential \ | ||
&& apt-get install -y --no-install-recommends default-libmysqlclient-dev build-essential \ | ||
&& pip install --no-cache-dir -r requirements.txt \ | ||
&& apt-get purge -y --auto-remove build-essential \ | ||
&& rm -Rf /var/lib/apt/lists/* \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& chown -R app:app /app | ||
|
||
USER app | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#Create a workspace | ||
POST http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 201 | ||
|
||
DELETE http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 200 | ||
|
||
#Get all workspaces that a user is in | ||
GET http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
HTTP 201 | ||
|
||
#Delete a workspace | ||
POST http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 201 | ||
|
||
DELETE http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 200 | ||
|
||
#Add a tag to a workspace | ||
POST http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 201 | ||
[Captures] | ||
workspace: jsonpath "$.workspace" | ||
|
||
POST http://127.0.0.1:8000/api/tags/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"workspace": {{workspace}}, | ||
"tag": "tag" | ||
} | ||
HTTP 201 | ||
|
||
DELETE http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 200 | ||
|
||
#Joining a workspace | ||
POST http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 201 | ||
|
||
GET http://127.0.0.1:8000/api/workspaces/join/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 201 | ||
|
||
DELETE http://127.0.0.1:8000/api/workspaces/ | ||
Authorization: Token fadc41688e2228acb6c2cd435362f4eda6f4130d | ||
Content-Type: application/json | ||
|
||
{ | ||
"name": "test222", | ||
"password": "test222" | ||
} | ||
HTTP 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters