Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +0 -86
Dockerfile
CHANGED
|
@@ -1,91 +1,5 @@
|
|
| 1 |
-
# VM Management API with Podman - Non-privileged Container
|
| 2 |
FROM ubuntu:22.04
|
| 3 |
|
| 4 |
-
# Set environment variables
|
| 5 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
-
ENV PYTHONUNBUFFERED=1
|
| 7 |
-
|
| 8 |
-
RUN apt-get update -qq && \
|
| 9 |
-
apt-get install -y -qq \
|
| 10 |
-
curl \
|
| 11 |
-
python3 \
|
| 12 |
-
python3-pip \
|
| 13 |
-
python3-dev \
|
| 14 |
-
build-essential \
|
| 15 |
-
ca-certificates \
|
| 16 |
-
gnupg \
|
| 17 |
-
lsb-release \
|
| 18 |
-
uidmap \
|
| 19 |
-
slirp4netns \
|
| 20 |
-
iptables \
|
| 21 |
-
fuse-overlayfs \
|
| 22 |
-
&& \
|
| 23 |
-
curl -fsSL https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_$(lsb_release -rs)/Release.key | \
|
| 24 |
-
gpg --dearmor | tee /etc/apt/keyrings/devel_kubic_libcontainers_stable.gpg > /dev/null && \
|
| 25 |
-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_stable.gpg] \
|
| 26 |
-
https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_$(lsb_release -rs)/ /" | \
|
| 27 |
-
tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list > /dev/null && \
|
| 28 |
-
apt-get update -qq && \
|
| 29 |
-
apt-get install -y -qq podman && \
|
| 30 |
-
# Clean up
|
| 31 |
-
apt-get clean && \
|
| 32 |
-
rm -rf /var/lib/apt/lists/*
|
| 33 |
-
|
| 34 |
-
# Create a non-root user for running podman rootlessly
|
| 35 |
-
RUN useradd -m -s /bin/bash -u 1000 vmuser && \
|
| 36 |
-
usermod -aG sudo vmuser && \
|
| 37 |
-
echo "vmuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 38 |
-
|
| 39 |
-
# Set up subuid/subgid for rootless podman
|
| 40 |
-
RUN echo "vmuser:100000:65536" >> /etc/subuid && \
|
| 41 |
-
echo "vmuser:100000:65536" >> /etc/subgid
|
| 42 |
-
|
| 43 |
-
# Configure podman for rootless operation
|
| 44 |
-
USER vmuser
|
| 45 |
-
WORKDIR /home/vmuser
|
| 46 |
-
|
| 47 |
-
# Set up podman configuration
|
| 48 |
-
RUN mkdir -p ~/.config/containers && \
|
| 49 |
-
echo '[registries.search]' > ~/.config/containers/registries.conf && \
|
| 50 |
-
echo 'registries = ["docker.io", "quay.io", "registry.fedoraproject.org"]' >> ~/.config/containers/registries.conf && \
|
| 51 |
-
echo '' >> ~/.config/containers/registries.conf && \
|
| 52 |
-
echo '[registries.insecure]' >> ~/.config/containers/registries.conf && \
|
| 53 |
-
echo 'registries = []' >> ~/.config/containers/registries.conf && \
|
| 54 |
-
echo '' >> ~/.config/containers/registries.conf && \
|
| 55 |
-
echo '[registries.block]' >> ~/.config/containers/registries.conf && \
|
| 56 |
-
echo 'registries = []' >> ~/.config/containers/registries.conf
|
| 57 |
-
|
| 58 |
-
# Set up podman storage
|
| 59 |
-
RUN mkdir -p ~/.local/share/containers/storage
|
| 60 |
-
|
| 61 |
-
# Copy application files
|
| 62 |
-
USER root
|
| 63 |
-
COPY . /app
|
| 64 |
-
RUN chown -R vmuser:vmuser /app
|
| 65 |
-
|
| 66 |
-
USER vmuser
|
| 67 |
-
WORKDIR /app
|
| 68 |
-
|
| 69 |
-
# Install Python dependencies
|
| 70 |
RUN pip3 install --user flask flask-cors requests
|
| 71 |
|
| 72 |
-
# Create directory for podman volumes (if needed)
|
| 73 |
-
RUN mkdir -p /tmp/vm-data
|
| 74 |
-
|
| 75 |
-
# Expose the port (7860 as configured)
|
| 76 |
-
EXPOSE 7860
|
| 77 |
-
|
| 78 |
-
# Set environment variables for podman
|
| 79 |
-
ENV XDG_RUNTIME_DIR=/tmp/runtime-vmuser
|
| 80 |
-
ENV DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/runtime-vmuser/bus
|
| 81 |
-
|
| 82 |
-
# Create runtime directory
|
| 83 |
-
RUN mkdir -p $XDG_RUNTIME_DIR && \
|
| 84 |
-
chmod 700 $XDG_RUNTIME_DIR
|
| 85 |
-
|
| 86 |
-
# Health check
|
| 87 |
-
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 88 |
-
CMD curl -f http://localhost:7860/ || exit 1
|
| 89 |
-
|
| 90 |
-
# Run the VM server
|
| 91 |
CMD ["python3", "lib.py", "server"]
|
|
|
|
|
|
|
| 1 |
FROM ubuntu:22.04
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
RUN pip3 install --user flask flask-cors requests
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
CMD ["python3", "lib.py", "server"]
|