From 8ecd7764af564ba4b6b1bb890782288bcfe9db2d Mon Sep 17 00:00:00 2001 From: Tom Hayward Date: Fri, 30 Dec 2022 18:12:28 -0800 Subject: [PATCH] run tests in container (#28) --- .github/workflows/django.yml | 12 +++--------- Dockerfile | 10 ++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 Dockerfile diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index cc10e79..af94e09 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -17,14 +17,8 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + - name: Build Container Image + run: docker build --build-arg PYTHON_VERSION=${{ matrix.python-version }} -t hamwan-portal . - name: Run Tests run: | - python manage.py test + docker run --rm hamwan-portal manage.py test diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5237c8d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +# syntax=docker/dockerfile:1.4 +ARG PYTHON_VERSION=2.7 +FROM python:$PYTHON_VERSION +EXPOSE 8000 +WORKDIR /app +COPY requirements.txt /app +RUN pip install -r requirements.txt --no-cache-dir +COPY . /app +ENTRYPOINT ["python"] +CMD ["manage.py", "runserver", "0.0.0.0:8000"]