aboutsummaryrefslogtreecommitdiff
path: root/include/docker.h
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-12-11 09:30:07 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-12-11 09:45:04 -0500
commit4fd92ec6b203d6b94b9e9f9531fd60a65736e810 (patch)
tree2b5be989ca839bd97f55f40605e23d7019397be7 /include/docker.h
parent1bec4776252cec88ec3336602c0c477c20a1292f (diff)
downloadstasis-4fd92ec6b203d6b94b9e9f9531fd60a65736e810.tar.gz
Restructure projectdelivery-lib
* Move headers to relevant include directories within the target tree(s) * Adjust doxygen configuration to search correct paths * Adjust CMake configuration to use new include paths
Diffstat (limited to 'include/docker.h')
-rw-r--r--include/docker.h92
1 files changed, 0 insertions, 92 deletions
diff --git a/include/docker.h b/include/docker.h
deleted file mode 100644
index 7585d86..0000000
--- a/include/docker.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//! @file docker.h
-#ifndef STASIS_DOCKER_H
-#define STASIS_DOCKER_H
-
-#include "core.h"
-
-//! Flag to squelch output from docker_exec()
-#define STASIS_DOCKER_QUIET 1 << 1
-
-//! Flag for older style docker build
-#define STASIS_DOCKER_BUILD 1 << 1
-//! Flag for docker buildx
-#define STASIS_DOCKER_BUILD_X 1 << 2
-
-//! Compress "docker save"ed images with a compression program
-#define STASIS_DOCKER_IMAGE_COMPRESSION "zstd"
-
-struct DockerCapabilities {
- int podman; //!< Is "docker" really podman?
- int build; //!< Is a build plugin available?
- int available; //!< Is a "docker" program available?
- int usable; //!< Is docker in a usable state for the current user?
-};
-
-/**
- * Determine the state of docker on the system
- *
- * ```c
- * struct DockerCapabilities docker_is;
- * if (!docker_capable(&docker_is)) {
- * fprintf(stderr, "%s is %savailable, and %susable\n",
- * docker_is.podman ? "Podman" : "Docker",
- * docker_is.available ? "" : "not ",
- * docker_is.usable ? "" : "not ");
- * exit(1);
- * }
- * ```
- *
- * @param result DockerCapabilities struct
- * @return 1 on success, 0 on error
- */
-int docker_capable(struct DockerCapabilities *result);
-
-/**
- * Execute a docker command
- *
- * Use the `STASIS_DOCKER_QUIET` flag to suppress all output from stdout and stderr.
- *
- * ```c
- * if (docker_exec("run --rm -t ubuntu:latest /bin/bash -c 'echo Hello world'", 0)) {
- * fprintf(stderr, "Docker hello world failed\n");
- * exit(1);
- * }
- * ```
- *
- * @param args arguments to pass to docker
- * @param flags
- * @return exit code from "docker"
- */
-int docker_exec(const char *args, unsigned flags);
-
-/**
- * Build a docker image
- *
- * ```c
- * struct DockerCapabilities docker_is;
- * docker_capable(&docker_is);
- *
- * if (docker_is.usable) {
- * printf("Building docker image\n");
- * if (docker_build("path/to/Dockerfile/dir")) {
- * fprintf("Docker build failed\n");
- * exit(1);
- * }
- * } else {
- * fprintf(stderr, "No usable docker installation available\n");
- * }
- * ```
- *
- * @param dirpath
- * @param args
- * @param engine
- * @return
- */
-int docker_build(const char *dirpath, const char *args, int engine);
-int docker_script(const char *image, char *data, unsigned flags);
-int docker_save(const char *image, const char *destdir, const char *compression_program);
-void docker_sanitize_tag(char *str);
-int docker_validate_compression_program(char *prog);
-
-
-#endif //STASIS_DOCKER_H