Joshua Sundance Bailey commited on
Commit
6f9ad82
1 Parent(s): 2908650
.github/workflows/docker-hub.yml CHANGED
@@ -23,6 +23,7 @@ jobs:
23
  - name: Build Docker image
24
  run: |
25
  docker build \
 
26
  -t joshuasundance/geospatial-data-converter:${{ github.ref_name }} \
27
  -t joshuasundance/geospatial-data-converter:latest \
28
  .
 
23
  - name: Build Docker image
24
  run: |
25
  docker build \
26
+ --target runtime \
27
  -t joshuasundance/geospatial-data-converter:${{ github.ref_name }} \
28
  -t joshuasundance/geospatial-data-converter:latest \
29
  .
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.11-slim-bookworm
2
 
3
  RUN adduser --uid 1000 --disabled-password --gecos '' appuser
4
  USER 1000
@@ -10,9 +10,17 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
10
  RUN pip install --user --no-cache-dir --upgrade pip
11
  COPY ./requirements.txt /home/appuser/requirements.txt
12
  RUN pip install --user --no-cache-dir --upgrade -r /home/appuser/requirements.txt
13
-
14
  COPY geospatial-data-converter/ /home/appuser/geospatial-data-converter/
15
 
 
 
 
 
 
 
 
 
 
16
  WORKDIR /workspace
17
  EXPOSE 7860
18
 
 
1
+ FROM python:3.11-slim-bookworm AS base
2
 
3
  RUN adduser --uid 1000 --disabled-password --gecos '' appuser
4
  USER 1000
 
10
  RUN pip install --user --no-cache-dir --upgrade pip
11
  COPY ./requirements.txt /home/appuser/requirements.txt
12
  RUN pip install --user --no-cache-dir --upgrade -r /home/appuser/requirements.txt
 
13
  COPY geospatial-data-converter/ /home/appuser/geospatial-data-converter/
14
 
15
+
16
+ FROM base AS test
17
+
18
+ COPY dev-requirements.txt /home/appuser/dev-requirements.txt
19
+ RUN pip install --user --no-cache-dir --upgrade -r /home/appuser/dev-requirements.txt
20
+
21
+
22
+ FROM base AS runtime
23
+
24
  WORKDIR /workspace
25
  EXPOSE 7860
26
 
dev-requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ pytest==7.4.3
2
+ pytest-cov==4.1.0
docker-compose.yml CHANGED
@@ -1,24 +1,23 @@
1
  version: '3.8'
2
 
3
  services:
4
- geospatial-data-converter:
5
- image: geospatial-data-converter:latest
6
- build: .
7
- ports:
8
- - "${APP_PORT:-7860}:${APP_PORT:-7860}"
9
- working_dir: /workspace
10
- command: [
11
- "streamlit", "run",
12
- "/home/appuser/geospatial-data-converter/app.py",
13
- "--server.port", "${APP_PORT:-7860}",
14
- "--server.address", "0.0.0.0",
15
- "--server.enableXsrfProtection=false"
16
- ]
17
  test:
18
- image: geospatial-data-converter:latest # Use the same image as your main service
19
- build: .
 
 
 
20
  volumes:
21
- - ./tests:/home/appuser/tests
22
  - ./pyproject.toml:/home/appuser/pyproject.toml
23
  working_dir: /home/appuser
24
  command: ["pytest"]
 
 
 
 
 
 
 
 
 
 
1
  version: '3.8'
2
 
3
  services:
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  test:
5
+ container_name: geospatial-data-converter-test
6
+ build:
7
+ context: .
8
+ dockerfile: Dockerfile
9
+ target: test
10
  volumes:
11
+ - ./tests/:/home/appuser/tests/
12
  - ./pyproject.toml:/home/appuser/pyproject.toml
13
  working_dir: /home/appuser
14
  command: ["pytest"]
15
+
16
+ geospatial-data-converter:
17
+ container_name: geospatial-data-converter
18
+ build:
19
+ context: .
20
+ dockerfile: Dockerfile
21
+ target: runtime
22
+ ports:
23
+ - "${APP_PORT:-7860}:${APP_PORT:-7860}"
pyproject.toml CHANGED
@@ -1,6 +1,7 @@
1
  [tool.pytest.ini_options]
2
  pythonpath = ["geospatial-data-converter"]
3
  testpaths = ["tests"]
 
4
 
5
  [tool.bumpver]
6
  current_version = "0.2.1"
 
1
  [tool.pytest.ini_options]
2
  pythonpath = ["geospatial-data-converter"]
3
  testpaths = ["tests"]
4
+ addopts = "--cov=geospatial-data-converter"
5
 
6
  [tool.bumpver]
7
  current_version = "0.2.1"
requirements.txt CHANGED
@@ -3,6 +3,5 @@ beautifulsoup4==4.12.2
3
  geopandas==0.14.1
4
  lxml==4.9.3
5
  pyogrio==0.7.2
6
- pytest==7.4.3
7
  restgdf==0.9.7
8
  streamlit==1.29.0
 
3
  geopandas==0.14.1
4
  lxml==4.9.3
5
  pyogrio==0.7.2
 
6
  restgdf==0.9.7
7
  streamlit==1.29.0