Skip to content

Pv/create docker image for deploy #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2022

Conversation

philvarner
Copy link
Collaborator

Related Issue(s):

  • n/a

Description:

  • create a Dockerfile.deploy that can be run as a standalone app
  • cleanup the Dockerfile.dev to remove a few things that don't do anything
  • migrate all ports to be 8080 instead of 8083 (the use of 8081 and 8082 were a byproduct of having sqlalchemy and pgstac impls in the same repo for stac-fastapi)
  • other random cleanup

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the changelog

FROM python:3.8-slim

RUN apt-get update && \
apt-get -y upgrade && \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only dev dependencies need buildessitials and git, so don't install.


COPY . /app

RUN pip install --no-cache-dir ./stac_fastapi/elasticsearch[server]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only install server deps, not dev also


EXPOSE 8080

CMD ["uvicorn", "stac_fastapi.elasticsearch.app:app", "--host", "0.0.0.0", "--port", "8080"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually run the app

run:
docker run -it -p 8080:8080 \
-e ENVIRONMENT=local \
-e ES_HOST=docker.for.mac.localhost \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will have to be updated for non-mac. tbd.

@@ -28,7 +29,6 @@
"pre-commit",
"requests",
"ciso8601",
"overrides",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have been a core dep rather than an extra. We never ran it without also installing the dev deps, so it didn't surface.

@@ -118,7 +118,7 @@ async def test_app_fields_extension(load_test_data, app_client, txn_client):
resp_json = resp.json()
assert list(resp_json["features"][0]["properties"]) == ["datetime"]

txn_client.delete_item(item["id"], item["collection"], request=MockRequest)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method doesn't use the request, so removing

@philvarner philvarner merged commit 6ad8591 into main Mar 23, 2022
@philvarner philvarner deleted the pv/create-docker-image-for-deploy branch March 23, 2022 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants