Skip to content

Commit

Permalink
Merge pull request #94 from aodn/DockerUpdate
Browse files Browse the repository at this point in the history
DockerUpdate
  • Loading branch information
lbesnard authored Nov 5, 2024
2 parents 87b63ec + 06d32bc commit 77687d9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- main
release:
types: [created]

jobs:
build:
Expand Down
38 changes: 25 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM python:3.12-slim

# Set environment variables for Poetry
ENV POETRY_VERSION=1.6.1 \
POETRY_VIRTUALENVS_CREATE=true \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_HOME="/opt/poetry"
ENV POETRY_VERSION=1.8.4
ENV POETRY_HOME=/opt/poetry
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
ENV POETRY_VIRTUALENVS_CREATE=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"

# Install Poetry and dependencies
RUN apt-get update && apt-get install -y curl && \
Expand All @@ -14,17 +19,24 @@ RUN apt-get update && apt-get install -y curl && \
# Set the working directory
WORKDIR /app

COPY poetry.lock pyproject.toml /app/
COPY . /app
#COPY poetry.lock pyproject.toml /app/

# Install dependencies
RUN poetry install --no-interaction --no-root
RUN poetry install --with dev --no-interaction # --no-root

COPY . /app

# Install the project
RUN poetry install --no-interaction
# Enable bash-completion and set bash as the default shell
RUN echo "alias ll='ls -la'" >> ~/.bashrc && \
echo "alias poetry='poetry run'" >> ~/.bashrc
## Run tests and verify the package build
#RUN poetry run pytest && \
#poetry build && \
#pip install dist/*.whl

# Configure the shell to automatically activate the venv
RUN echo "source ${VIRTUAL_ENV}/bin/activate" >> ~/.bashrc

#ENTRYPOINT ["bash"]

# Run tests and verify the package build
RUN poetry run pytest && \
poetry build && \
pip install dist/*.whl
CMD ["/usr/bin/bash"]
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
aodn_cloud_optimised:
container_name: aodn_cloud_optimised
build:
context: .
dockerfile: Dockerfile
ports:
- "8284:80"
volumes:
- ${PWD}:/app/shared
- $HOME/.aws:/root/.aws:ro # Mount the .aws directory in read-only mode
#- /tmp/aodn_cloud_optimised/config:/app/aodn_cloud_optimised/config # Mount config folder
environment:
- AWS_PROFILE=${AWS_PROFILE}
stdin_open: true # Keep STDIN open for interactive sessions
tty: true

0 comments on commit 77687d9

Please sign in to comment.