Skip to content

Commit

Permalink
docker-poetry-config
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Aug 17, 2024
1 parent 7f8ee5e commit d5daad9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# adapted from https://dev.to/farcellier/package-a-poetry-project-in-a-docker-container-for-production-3b4m

FROM python:3.12.5-slim-bookworm AS build

# Set our workdir
Expand All @@ -7,9 +9,9 @@ WORKDIR /app
RUN pip install --no-cache-dir poetry==1.8.3

# Now copy the app over and build a wheel
COPY src /app/src/
COPY pyproject.toml /app/
RUN poetry install
COPY athena_federation /app/athena_federation/
COPY . /app
RUN poetry install --without dev --no-interaction

## Now use the compiled wheel in our lambda function
FROM arm64v8/python:3.12.5-slim-bookworm AS lambda
Expand All @@ -20,7 +22,7 @@ COPY --from=build /app/dist/athena_federation-*-py3-none-any.whl /
RUN pip install --no-cache-dir /athena_federation-*-py3-none-any.whl

WORKDIR /app
COPY example/ ./
ENV PATH="/app/.venv/bin:$PATH"
RUN ls ./

CMD [ "handler.lambda_handler" ]
CMD ["pytest"]
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ docker-build:
docker build -t athena-federation .

docker-debug:
docker build -t athena-federation . --no-cache --build-arg DEBUG=true --build-arg ARCHITECTURE=arm64
docker build -t athena-federation . --no-cache --build-arg DEBUG=true

docker-poetry-config:
poetry config virtualenvs.in-project true --local

# Run Docker container

Expand Down
2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true

0 comments on commit d5daad9

Please sign in to comment.