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

feat(core): new test container #80

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
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"]
Roberamelaek marked this conversation as resolved.
Show resolved Hide resolved
41 changes: 34 additions & 7 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,23 +15,49 @@ 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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why you were getting the error that you screenshot on Discord. It would be best if you had the previous changes up to date.

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:
context: ./frontend/
dockerfile: Dockerfile
volumes:
- ./frontend:/workspace/frontend
- ./frontend/node_modules:/workspace/frontend/node_modules
command: npm run start
ports:
- "3000:3000"
- "9229:9229"
stdin_open: true
tty: true
depends_on:
- svc

test:
build:
context: .
dockerfile: Dockerfile.test
Roberamelaek marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- .:/workspace
environment:
- POSTGRES_DB=saptable
- POSTGRES_USER=rootUser
- POSTGRES_PASSWORD=rootPassword
depends_on:
- db
- svc

volumes:
postgresData:
Expand Down