Skip to content

Commit

Permalink
feat(pydiscordsh): adding the base dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
h0lybyte committed Jan 6, 2025
1 parent 330f44b commit 275040d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
37 changes: 37 additions & 0 deletions apps/pydiscordsh/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Base image with Python and Poetry pre-installed
FROM python:3.11-slim

# Set environment variables for Poetry and Python
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.8.2 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1

# Install system dependencies and Poetry
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
&& curl -sSL https://install.python-poetry.org | python3 - \
&& ln -s /opt/poetry/bin/poetry /usr/local/bin/poetry \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy only the relevant files for dependency installation first
COPY pyproject.toml poetry.lock ./

# Install dependencies with Poetry (including project dependencies)
RUN poetry install --no-root --only main

# Copy the rest of the app code
COPY . .

# Install the project itself (if it's structured as a package)
RUN poetry install --no-dev

# Set the default command to run the application
CMD ["poetry", "run", "python", "-m", "pydiscordsh"]
Empty file added apps/pydiscordsh/main.py
Empty file.
31 changes: 31 additions & 0 deletions apps/pydiscordsh/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@
"cwd": "apps/pydiscordsh"
},
"cache": true
},
"container": {
"executor": "@nx-tools/nx-container:build",
"defaultConfiguration": "local",
"options": {
"engine": "docker",
"context": "apps/pydiscordsh",
"file": "apps/pydiscordsh/Dockerfile",
"metadata": {
"images": ["kbve/pydiscordsh"],
"load": true,
"tags": ["1.42", "1.42.0"]
},
"configurations": {
"local": {
"tags": ["1.42", "1.42.0"],
"push": false
},
"production": {
"tags": ["1.42", "1.42.0"],
"push": true,
"customBuildOptions": "--push",
"cache-from": [
"type=registry,ref=kbve/pydiscordsh:buildcache"
],
"cache-to": [
"type=registry,ref=kbve/pydiscordsh:buildcache,mode=max"
]
}
}
}
}
},
"tags": [],
Expand Down

0 comments on commit 275040d

Please sign in to comment.