Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
47 changes: 27 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
FROM python:3.11-slim-bookworm
FROM python:3.12-slim-bookworm AS builder

RUN apt-get update && apt-get install -y curl procps iputils-ping netcat-traditional && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y curl && \
apt-get clean && rm -rf /var/lib/apt/lists/*

ARG BUILD_TYPE
COPY requirements.txt /

ADD /ex_app/cs[s] /ex_app/css
ADD /ex_app/im[g] /ex_app/img
ADD /ex_app/j[s] /ex_app/js
ADD /ex_app/l10[n] /ex_app/l10n
ADD /ex_app/li[b] /ex_app/lib

COPY --chmod=775 healthcheck.sh /
COPY --chmod=775 start.sh /

# Download and install FRP client
RUN set -ex; \
ARCH=$(uname -m); \
Expand All @@ -33,20 +23,37 @@ RUN set -ex; \
rm -rf /tmp/frp /tmp/frp.tar.gz

# Installing PyTorch based on BUILD_TYPE
RUN ARCH=$(uname -m) && \
RUN --mount=type=cache,target=/root/.cache/pip \
ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then \
echo "Installing PyTorch for ARM64"; \
python3 -m pip install torch==2.4.1 torchvision torchaudio; \
python3 -m pip install --root-user-action=ignore torch==2.4.1 torchvision torchaudio; \
elif [ "$BUILD_TYPE" = "rocm" ]; then \
python3 -m pip install torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1; \
python3 -m pip install --root-user-action=ignore torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1; \
elif [ "$BUILD_TYPE" = "cpu" ]; then \
python3 -m pip install torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; \
python3 -m pip install --root-user-action=ignore torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; \
else \
python3 -m pip install torch==2.4.1 torchvision torchaudio; \
python3 -m pip install --root-user-action=ignore torch==2.4.1 torchvision torchaudio; \
fi

RUN \
python3 -m pip install -r requirements.txt && rm -rf ~/.cache && rm requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m pip install --root-user-action=ignore -r requirements.txt && rm requirements.txt

FROM python:3.12-slim-bookworm

COPY --from=builder /usr/local/ /usr/local/

RUN apt-get update && apt-get install -y curl procps iputils-ping netcat-traditional && \
apt-get clean && rm -rf /var/lib/apt/lists/*

ADD /ex_app/cs[s] /ex_app/css
ADD /ex_app/im[g] /ex_app/img
ADD /ex_app/j[s] /ex_app/js
ADD /ex_app/l10[n] /ex_app/l10n
ADD /ex_app/li[b] /ex_app/lib

COPY --chmod=775 healthcheck.sh /
COPY --chmod=775 start.sh /

WORKDIR /ex_app/lib
ENTRYPOINT ["/start.sh"]
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ help:
.PHONY: build-push
build-push:
docker login ghcr.io
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release --build-arg BUILD_TYPE=cpu .
docker buildx build --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release-cuda --build-arg BUILD_TYPE=cuda .
docker buildx build --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release-rocm --build-arg BUILD_TYPE=rocm .
DOCKER_BUILDKIT=1 docker buildx build --progress=plain --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release --build-arg BUILD_TYPE=cpu .
DOCKER_BUILDKIT=1 docker buildx build --progress=plain --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release-cuda --build-arg BUILD_TYPE=cuda .
DOCKER_BUILDKIT=1 docker buildx build --progress=plain --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release-rocm --build-arg BUILD_TYPE=rocm .

.PHONY: build-push-latest
build-push-latest:
docker login ghcr.io
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest --build-arg BUILD_TYPE=cpu .
docker buildx build --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-cuda --build-arg BUILD_TYPE=cuda .
docker buildx build --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-rocm --build-arg BUILD_TYPE=rocm .
DOCKER_BUILDKIT=1 docker buildx build --progress=plain --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest --build-arg BUILD_TYPE=cpu .
DOCKER_BUILDKIT=1 docker buildx build --progress=plain --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-cuda --build-arg BUILD_TYPE=cuda .
DOCKER_BUILDKIT=1 docker buildx build --progress=plain --push --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-rocm --build-arg BUILD_TYPE=rocm .

.PHONY: run30
run30:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nc_py_api[app]>=0.19.1
nc_py_api[app]>=0.19.2