generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
affa11a
commit 11ad034
Showing
2 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Use an official Python runtime as a base image | ||
FROM python:3.12 | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Install system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends gcc curl gnupg2 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Poetry | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# Add Poetry to PATH | ||
ENV PATH="${PATH}:/root/.local/bin" | ||
|
||
# Copy only the pyproject.toml and poetry.lock to leverage Docker cache | ||
COPY pyproject.toml poetry.lock /app/ | ||
|
||
# Install project dependencies | ||
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi | ||
|
||
# Copy the entire Django project to the working directory | ||
COPY . /app/ | ||
|
||
# Expose the port your application will run on | ||
EXPOSE 8000 | ||
|
||
# Command to run the Django server | ||
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
version: '3.8' # Use the version of Docker Compose that you need | ||
version: "3.9" # Use the version of Docker Compose that you need | ||
|
||
services: | ||
postgresdb: | ||
image: postgres:latest # Use the latest PostgreSQL image | ||
container_name: postgresdb # Name your container | ||
db: | ||
image: postgres # Use the latest PostgreSQL image | ||
volumes: | ||
- ./data/db:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: yourusername # Set the username for the PostgreSQL database | ||
POSTGRES_PASSWORD: yourpassword # Set the password for the PostgreSQL database | ||
POSTGRES_DB: yourdatabase # Set the name of the database | ||
- POSTGRES_USER=yourusername # Set the username for the PostgreSQL database | ||
- POSTGRES_PASSWORD=yourpassword # Set the password for the PostgreSQL database | ||
- POSTGRES_DB=yourdatabase # Set the name of the database | ||
ports: | ||
- "5432:5432" # Map the PostgreSQL port to the host | ||
backend: | ||
build: ./backend | ||
command: python manage.py runserver 0.0.0.0:8000 | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data # Persist the data using a named volume | ||
|
||
volumes: | ||
postgres_data: | ||
driver: local # Use the local driver for the volume | ||
|
||
- .:/code | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- db |