Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update Dockerfile and project files for UV migration
- Changed base image to use UV with Python 3.11.
- Updated working directory and file copying to align with UV requirements.
- Removed requirements.txt and replaced it with uv.lock and pyproject.toml for dependency management.
- Modified README to reflect new build and run commands.
- Set default command to run the application using UV.
  • Loading branch information
hasansezertasan committed Sep 7, 2025
commit ea00355e510fa03f23b91c647a4c51ad8f11fc16
36 changes: 17 additions & 19 deletions examples/docker-flask/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
# Use the official Python image as the base image
FROM python:3.9-slim
# Use the official UV image
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy

# Set the working directory
# Set the working directory to /app
WORKDIR /app

# Copy the requirements file
COPY requirements.txt .
# Copy the uv.lock file and the pyproject.toml file
COPY uv.lock pyproject.toml /app/

#Install the libcups library
RUN apt-get update -y && apt-get install libcups2-dev -y
# Install the Python packages
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install python-escpos --pre

# Install Git
RUN apt-get update && \
apt-get install -y git && \
# Install the libcups library and Git, then clean up apt lists
RUN apt-get update -y && \
apt-get install -y libcups2-dev git && \
rm -rf /var/lib/apt/lists/*

# Copy the Flask app
COPY app.py .
# Install the dependencies
RUN uv sync --frozen --no-install-project --no-dev

# Copy the rest of the application code to the container
COPY . /app

# Expose the port the Flask app will run on
# Expose the port the application will run on
EXPOSE 8080

# Run the Flask app
CMD ["python", "app.py"]
# Set the default command to run the application
CMD ["uv", "run", "app.py"]
8 changes: 5 additions & 3 deletions examples/docker-flask/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Flask and Python-ESC/POS example

Simple example on how to use it inside a web service

```
```sh
docker build . -t escpos-web
docker run --network=host -p 9999:9999 escpos
```
docker run --network=host -p 9999:9999 escpos-web
```
2 changes: 1 addition & 1 deletion examples/docker-flask/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "flask-example"
version = "0.1.0"
description = "Add your description here"
description = "Flask and Python-ESC/POS example"
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
Expand Down
20 changes: 0 additions & 20 deletions examples/docker-flask/requirements.txt

This file was deleted.

Loading