ovirt-imageio/container/Containerfile

23 lines
545 B
Plaintext
Raw Permalink Normal View History

# SPDX-FileCopyrightText: 2022 Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
# Build stage
FROM alpine AS build
RUN apk add --no-cache --update build-base linux-headers python3 python3-dev py3-pip
WORKDIR /build
COPY ovirt-imageio.tar.gz .
RUN python3 -m venv /venv
RUN /venv/bin/pip install ovirt-imageio.tar.gz
# Final stage
FROM alpine
container: serve image with nbd Include qemu-nbd in the container to make it easier for users to use the containerized imageio server. The container now runs with a script as an ENTRYPOINT. The script runs as a program that can receive additional command line parameters. The script is basically a launcher for the two main services involved: - qemu-nbd serving the image - ovirt-imageio exposing the image through http This commit removes support for file ticket, only nbd tickets are implicitely used. This is better, as nbd does much of the hard work for us, so will perform better. Users will not have to worry about the ticket anyway, the ticket is also generated automatically, so no need to mount the ticket inside the container, or give an environment variable. Users can set the ticket ID in the command line, or use the file name as default. Example session: $ mkdir /var/tmp/images $ qemu-img create -f raw /var/tmp/images/disk.raw 6g $ podman run \ --interactive \ --tty \ --rm \ --publish 8080:80 \ --volume /var/tmp/images:/var/tmp:Z \ localhost/ovirt-imageio:latest /var/tmp/disk.raw 2022-10-20 14:46:08,953 INFO (MainThread) [server] Starting (hostname=1594cc8a121b pid=8, version=2.4.7) 2022-10-20 14:46:08,970 INFO (MainThread) [services] remote.service listening on ('::', 80) 2022-10-20 14:46:08,970 INFO (MainThread) [server] Initial ticket: /ticket.json 2022-10-20 14:46:08,971 INFO (MainThread) [server] Ready for requests ... 2022-10-26 12:07:00,155 INFO (MainThread) [server] Received signal 2, shutting down Interrupted, shutting down $ examples/imageio-client download -f raw http://localhost:8080/images/disk.raw download.raw [ 100% ] 6.00 GiB, 0.10 s, 57.23 GiB/s Signed-off-by: Albert Esteve <aesteve@redhat.com>
2022-10-20 16:48:40 +02:00
RUN apk add python3 qemu-img
RUN mkdir /etc/ovirt-imageio
COPY --from=build /venv /venv
COPY conf.d /etc/ovirt-imageio/conf.d
container: serve image with nbd Include qemu-nbd in the container to make it easier for users to use the containerized imageio server. The container now runs with a script as an ENTRYPOINT. The script runs as a program that can receive additional command line parameters. The script is basically a launcher for the two main services involved: - qemu-nbd serving the image - ovirt-imageio exposing the image through http This commit removes support for file ticket, only nbd tickets are implicitely used. This is better, as nbd does much of the hard work for us, so will perform better. Users will not have to worry about the ticket anyway, the ticket is also generated automatically, so no need to mount the ticket inside the container, or give an environment variable. Users can set the ticket ID in the command line, or use the file name as default. Example session: $ mkdir /var/tmp/images $ qemu-img create -f raw /var/tmp/images/disk.raw 6g $ podman run \ --interactive \ --tty \ --rm \ --publish 8080:80 \ --volume /var/tmp/images:/var/tmp:Z \ localhost/ovirt-imageio:latest /var/tmp/disk.raw 2022-10-20 14:46:08,953 INFO (MainThread) [server] Starting (hostname=1594cc8a121b pid=8, version=2.4.7) 2022-10-20 14:46:08,970 INFO (MainThread) [services] remote.service listening on ('::', 80) 2022-10-20 14:46:08,970 INFO (MainThread) [server] Initial ticket: /ticket.json 2022-10-20 14:46:08,971 INFO (MainThread) [server] Ready for requests ... 2022-10-26 12:07:00,155 INFO (MainThread) [server] Received signal 2, shutting down Interrupted, shutting down $ examples/imageio-client download -f raw http://localhost:8080/images/disk.raw download.raw [ 100% ] 6.00 GiB, 0.10 s, 57.23 GiB/s Signed-off-by: Albert Esteve <aesteve@redhat.com>
2022-10-20 16:48:40 +02:00
COPY app /app
EXPOSE 80/tcp
container: serve image with nbd Include qemu-nbd in the container to make it easier for users to use the containerized imageio server. The container now runs with a script as an ENTRYPOINT. The script runs as a program that can receive additional command line parameters. The script is basically a launcher for the two main services involved: - qemu-nbd serving the image - ovirt-imageio exposing the image through http This commit removes support for file ticket, only nbd tickets are implicitely used. This is better, as nbd does much of the hard work for us, so will perform better. Users will not have to worry about the ticket anyway, the ticket is also generated automatically, so no need to mount the ticket inside the container, or give an environment variable. Users can set the ticket ID in the command line, or use the file name as default. Example session: $ mkdir /var/tmp/images $ qemu-img create -f raw /var/tmp/images/disk.raw 6g $ podman run \ --interactive \ --tty \ --rm \ --publish 8080:80 \ --volume /var/tmp/images:/var/tmp:Z \ localhost/ovirt-imageio:latest /var/tmp/disk.raw 2022-10-20 14:46:08,953 INFO (MainThread) [server] Starting (hostname=1594cc8a121b pid=8, version=2.4.7) 2022-10-20 14:46:08,970 INFO (MainThread) [services] remote.service listening on ('::', 80) 2022-10-20 14:46:08,970 INFO (MainThread) [server] Initial ticket: /ticket.json 2022-10-20 14:46:08,971 INFO (MainThread) [server] Ready for requests ... 2022-10-26 12:07:00,155 INFO (MainThread) [server] Received signal 2, shutting down Interrupted, shutting down $ examples/imageio-client download -f raw http://localhost:8080/images/disk.raw download.raw [ 100% ] 6.00 GiB, 0.10 s, 57.23 GiB/s Signed-off-by: Albert Esteve <aesteve@redhat.com>
2022-10-20 16:48:40 +02:00
ENTRYPOINT [ "/app/entrypoint.py" ]