Skip to content

Commit

Permalink
add dockerignore
Browse files Browse the repository at this point in the history
  • Loading branch information
yrobla committed Dec 2, 2024
1 parent ba4678b commit 4773c6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
__pycache__
*.pyc
*.pyo
tests/
docs/
17 changes: 3 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
&& rm -rf /var/lib/apt/lists/*

# Set environment variable to ensure Python modules are installed in the correct location
ENV PYTHONPATH=/app

# Install Poetry
RUN pip install poetry==1.8.4

# Create a non-root user and switch to it
RUN adduser --system --no-create-home codegate --uid 1000
RUN pip install poetry==1.8.4 && rm -rf /root/.cache/pip

# Set the working directory
WORKDIR /app

# Copy only the files needed for installing dependencies
COPY pyproject.toml poetry.lock* /app/

# Configure Poetry and install dependencies
Expand All @@ -40,14 +32,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Create a non-root user and switch to it
RUN adduser --system --no-create-home codegate --uid 1000
USER codegate
WORKDIR /app

# Copy necessary artifacts from the builder stage
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /app /app

# Set the working directory
WORKDIR /app

# Set the PYTHONPATH environment variable
ENV PYTHONPATH=/app/src

Expand All @@ -56,5 +46,4 @@ VOLUME ["/app/weaviate_data"]

# Set the container's default entrypoint
EXPOSE 8989
#ENTRYPOINT ["python", "-m", "src.codegate.cli", "serve", "--port", "8989", "--host", "0.0.0.0"]
CMD ["python", "-m", "src.codegate.cli", "serve", "--port", "8989", "--host", "0.0.0.0"]
ENTRYPOINT ["python", "-m", "src.codegate.cli", "serve", "--port", "8989", "--host", "0.0.0.0"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
description = "Generative AI CodeGen security gateway"
readme = "README.md"
authors = []
packages = [{include = "codegate", from = "src"}]
package-mode = false

[tool.poetry.dependencies]
python = ">=3.11"
Expand Down

0 comments on commit 4773c6b

Please sign in to comment.