Skip to content

Commit

Permalink
Flag future changes in seed.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
akuny committed Mar 8, 2024
1 parent 493bf9b commit 763fe4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ ENV PATH="${PATH}:/opt/poetry/bin"
# Add the current directory to the PYTHONPATH
ENV PYTHONPATH="${PYTHONPATH}:/app"

# Create a non-root user to run the app
RUN useradd --create-home --shell /bin/bash appuser

# Install dependencies and start app
WORKDIR /app
COPY pyproject.toml poetry.lock ./
Expand All @@ -43,5 +40,9 @@ RUN pip install -r requirements.txt
COPY . .
RUN python -m compileall /app

# Create and switch to a non-root user to run the app
RUN useradd --create-home --shell /bin/bash appuser
USER appuser

# Start application
CMD ["/bin/sh", "./scripts/start_local.sh"]
11 changes: 8 additions & 3 deletions scripts/seed.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import zipfile
from nad_ch.config import create_app_context, OAUTH2_CONFIG
from nad_ch.domain.entities import DataProducer, DataSubmission, User
from nad_ch.domain.entities import ColumnMap, DataProducer, DataSubmission, User


def zip_directory(folder_path, zip_path):
Expand Down Expand Up @@ -32,6 +32,10 @@ def main():
)
ctx.users.add(new_user)

new_column_map = ColumnMap(name="New Jersey Mapping v1", producer=saved_producer)
# TODO save column map once ApplicationContext can provide a repository
# saved_column_map = ctx.column_maps.add(new_column_map)

current_script_path = os.path.abspath(__file__)
project_root = os.path.dirname(os.path.dirname(current_script_path))
gdb_path = os.path.join(
Expand All @@ -44,8 +48,9 @@ def main():

filename = DataSubmission.generate_filename(zipped_gdb_path, saved_producer)
ctx.storage.upload(zipped_gdb_path, filename)
new_submission = DataSubmission(filename, saved_producer)
ctx.submissions.add(new_submission)
# TODO save submission once column map has been saved to disk
# new_submission = DataSubmission(filename, saved_producer, saved_column_map)
# ctx.submissions.add(new_submission)

os.remove(zipped_gdb_path)

Expand Down

0 comments on commit 763fe4f

Please sign in to comment.