feat(docker): apply patch directly in Dockerfile using patch command

- Copy my_endnode_streaming.patch into the image and apply it with the patch tool during build
- Removes the need for git in the runtime environment
- Ensures the custom code changes are always present in the built image
pull/21981/head
YiQiu Jia 11 months ago
parent 620f2e4a9e
commit da091d4976

@ -3,4 +3,7 @@ FROM langgenius/dify-api:1.5.1
RUN apt-get update && apt-get install -y git \ RUN apt-get update && apt-get install -y git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY my_endnode_streaming.patch /app/my_endnode_streaming.patch
RUN git apply my_endnode_streaming.patch
# docker build -f docker/Dockerfile.patch -t land007/dify-api:1.5.1 . # docker build -f docker/Dockerfile.patch -t land007/dify-api:1.5.1 .

@ -517,7 +517,7 @@ x-shared-env: &shared-api-worker-env
services: services:
# API service # API service
api: api:
image: land007/dify-api:1.5.1 image: langgenius/dify-api:1.5.1
restart: always restart: always
environment: environment:
# Use the shared environment variables. # Use the shared environment variables.
@ -537,15 +537,8 @@ services:
redis: redis:
condition: service_started condition: service_started
volumes: volumes:
# Mount the storage directory to the container, for storing user files.
- ./volumes/app/storage:/app/api/storage - ./volumes/app/storage:/app/api/storage
- ../my_endnode_streaming.patch:/app/my_endnode_streaming.patch
command: >
sh -c "if [ -f /app/my_endnode_streaming.patch ]; then \
cd /app && \
git apply --check my_endnode_streaming.patch && \
git apply my_endnode_streaming.patch || echo 'Patch already applied or not applicable'; \
fi; \
exec /start-api.sh"
networks: networks:
- ssrf_proxy_network - ssrf_proxy_network
- default - default
@ -571,15 +564,8 @@ services:
redis: redis:
condition: service_started condition: service_started
volumes: volumes:
# Mount the storage directory to the container, for storing user files.
- ./volumes/app/storage:/app/api/storage - ./volumes/app/storage:/app/api/storage
- ../my_endnode_streaming.patch:/app/my_endnode_streaming.patch
command: >
sh -c "if [ -f /app/my_endnode_streaming.patch ]; then \
cd /app && \
git apply --check my_endnode_streaming.patch && \
git apply my_endnode_streaming.patch || echo 'Patch already applied or not applicable'; \
fi; \
exec /start-worker.sh"
networks: networks:
- ssrf_proxy_network - ssrf_proxy_network
- default - default

Loading…
Cancel
Save