Skip to content
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

Dockerfile improvements, and and deployable version (comments and questions) #10

Open
duckontheweb opened this issue Aug 6, 2022 · 1 comment

Comments

@duckontheweb
Copy link
Contributor

Ported from stac-utils/stac-fastapi#379.

Original Issue:

I've made some improvements to the Dockerfile used for development in stac-fastapi-elasticsearch https://github.com/stac-utils/stac-fastapi-elasticsearch/blob/main/Dockerfile.dev

and created one that generates a deployable image https://github.com/stac-utils/stac-fastapi-elasticsearch/blob/main/Dockerfile.deploy

I can port these changes to here if desired.

A few of the concerns I had about the existing Dockerfile are:

I'm not sure why it uses a 2-phase build with no directives in the first phase?

FROM python:3.8-slim as base

FROM base as builder

I don't think we have any requirements that need building from source or need git:

# Any python libraries that require system libraries to be installed will likely
# need the following packages in order to build
RUN apt-get update && apt-get install -y build-essential git

This isn't used anywhere in our code, and I couldn't find any tools that require it:

ARG install_dev_dependencies=true

So it creates an /install dir, but then never uses it?

ENV PATH=$PATH:/install/bin

RUN mkdir -p /install && \
@betolink
Copy link

Having a deployable version would be nice indeed, I tried to deploy the image on its own and it ran into some errors:

services:
  app:
    container_name: stac-fastapi-pgstac
    image: ghcr.io/stac-utils/stac-fastapi-pgstac:latest # <-- no build context
    environment:
      - APP_HOST=0.0.0.0
      - APP_PORT=8082
      - RELOAD=true
      # ... the rest of the env variables are the same
    ports:
      - "8082:8082"
    volumes:
      - .:/app # <- do we need this when we deploy it from the image?
    depends_on:
      - database

Note that I'm not using a different entry point so it goes with the one from the Dockerfile. And yet I get:

stac-fastapi-pgstac  |   File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
stac-fastapi-pgstac  | ModuleNotFoundError: No module named 'stac_fastapi.pgstac'

Is there something I'm missing? @vincentsarago

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

No branches or pull requests

2 participants