Skip to content

Commit

Permalink
new test contatiner
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberamelaek committed Aug 31, 2023
1 parent 6170e9c commit 41d0978
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
27 changes: 27 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use the same base image as the main svc container
FROM python:3.9.1

# Set the user to non-root
# RUN useradd -ms /bin/bash appuser -u 1000

# USER appuser

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Set the working directory in the container
WORKDIR /workspace


# copying the requirements.txt file to the work directory
COPY requirements*.txt ./

# Installing the python requirement on the container
RUN pip install -r requirements-dev.txt

# Copy all local files to the container
COPY . ./

# Run tests
CMD ["pytest"]
22 changes: 18 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.3"


services:
db:
image: postgres
Expand All @@ -14,20 +15,19 @@ services:

svc:
build: .
# user: 1000:1000
command: bash -c "python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/workspace
ports:
- "8000:8000"
- "5678:5678"
environment:
- POSTGRES_DB=saptable
- POSTGRES_USER=rootUser
- POSTGRES_PASSWORD=rootPassword
depends_on:
- db
command: ["bash", "-c",
"pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 \
manage.py runserver 0.0.0.0:8000 --nothreading --noreload"]
ui:
# restart: always
build:
Expand All @@ -45,6 +45,20 @@ services:
depends_on:
- svc

test:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- .:/workspace
environment:
- POSTGRES_DB=saptable
- POSTGRES_USER=rootUser
- POSTGRES_PASSWORD=rootPassword
depends_on:
- db
- svc

volumes:
postgresData:
frontend:
Expand Down

0 comments on commit 41d0978

Please sign in to comment.