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

DockerUpdate #94

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading