diff --git a/Dockerfile b/Dockerfile index cd4c7f6..bbe71cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,27 +2,11 @@ FROM python:3.12.5-slim-bookworm AS build -# Set our workdir -WORKDIR /app - # Get ready to build RUN pip install --no-cache-dir poetry==1.8.3 -# Now copy the app over and build a wheel -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 +COPY . . -ENV TARGET_BUCKET=replace_me - -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 -ENV PATH="/app/.venv/bin:$PATH" -RUN ls -R ./ +RUN poetry install --without dev --no-interaction -# CMD [ "tests.handler.lambda_handler" ] +ENTRYPOINT ["poetry", "run", "python", "-m", "athena_federation.main"] diff --git a/Makefile b/Makefile index a3fa33e..3330fde 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,7 @@ docker-status: # Build Docker image docker-build: docker build -t $(PROJ) . + docker images | grep $(PROJ) docker-debug: docker build -t $(PROJ) . --no-cache --build-arg DEBUG=true @@ -60,7 +61,7 @@ docker-poetry-config: # Run Docker container -docker-run: docker-build +docker-run: docker run -it -p $(PORT):$(PORT) $(PROJ) # Run Docker container in detached mode diff --git a/README.md b/README.md index b79d92f..a932324 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,12 @@ make watch make publish ``` -## Testing Docker Container Locally +## Testing Connector Locally Using Docker + +**WARNING: This currently only works on ARM64 machines.** You can test your Lambda function locally using Lambda Docker images. -Note that you must have the Docker daemon running on your machine. +Note that you must have a Docker daemon running on your machine. You can test it by calling the CLI: ### Verifying Docker is running @@ -67,7 +69,7 @@ docker ps ### Logging in to Docker -You will need an account on, e.g., https://hub.docker.com. +You will need an account on, e.g., [Docker Hub](https://hub.docker.com). ```shell sudo docker login diff --git a/athena_federation/main.py b/athena_federation/main.py new file mode 100755 index 0000000..eca29f6 --- /dev/null +++ b/athena_federation/main.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import os +import sys + + +def main(): + print("Hello from athena_federation!") + print("Arguments: ", sys.argv) + print("Environment: ", os.environ["VIRTUAL_ENV"]) + + +if __name__ == "__main__": + main()