-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit for adding docker to lg
- Loading branch information
Showing
7 changed files
with
79 additions
and
7 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,7 @@ | ||
# Database Configuration | ||
MYSQL_HOST=db | ||
MYSQL_PORT=3306 | ||
MYSQL_USER=user | ||
MYSQL_PASSWORD=password | ||
MYSQL_DATABASE=lazygrocer_db | ||
MYSQL_ROOT_PASSWORD=rootpassword |
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 |
---|---|---|
|
@@ -3,4 +3,8 @@ | |
__pycache__ | ||
|
||
# virtual environment | ||
env/ | ||
.lg-venv-win | ||
.lg-venv | ||
|
||
# environment variables | ||
.env |
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,38 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: . | ||
container_name: lazygrocer_app | ||
ports: | ||
- "8000:8000" | ||
env_file: | ||
- .env | ||
environment: | ||
MYSQL_HOST: ${MYSQL_HOST} | ||
MYSQL_PORT: ${MYSQL_PORT} | ||
MYSQL_USER: ${MYSQL_USER} | ||
MYSQL_PASSWORD: ${MYSQL_PASSWORD} | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
depends_on: | ||
- db | ||
volumes: | ||
- .:/src | ||
|
||
db: | ||
image: mysql:8.0 | ||
container_name: lazygrocer_db | ||
env_file: | ||
- .env | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
MYSQL_USER: ${MYSQL_USER} | ||
MYSQL_PASSWORD: ${MYSQL_PASSWORD} | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- db_data:/var/lib/mysql | ||
|
||
volumes: | ||
db_data: |
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,27 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.10-slim | ||
|
||
# Set environment variables | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Set working directory in the container | ||
WORKDIR /src | ||
|
||
# Install system dependencies for MySQL client | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
default-libmysqlclient-dev build-essential && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the application code to the container | ||
COPY . /src/ | ||
|
||
# Install Python dependencies | ||
RUN pip install --no-cache-dir --upgrade pip && \ | ||
pip install --no-cache-dir -r requirements.txt | ||
|
||
# Expose the port the app runs on (optional) | ||
EXPOSE 8000 | ||
|
||
# Command to run the application | ||
CMD ["python", "src/main.py"] |
Empty file.
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
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