aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 15:58:50 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 15:58:50 -0400
commitd3e198d5c7d76342d032554f45539714034e4bae (patch)
tree74206a0288c6e79e6a1b1df651efed5f4481e8fc
parent507c003a36584fae29cba00ca8e264488f39476e (diff)
downloadstasis-d3e198d5c7d76342d032554f45539714034e4bae.tar.gz
Avoid building docker images when no Dockerfile is present
-rw-r--r--src/deliverable.c8
-rw-r--r--src/main.c14
2 files changed, 15 insertions, 7 deletions
diff --git a/src/deliverable.c b/src/deliverable.c
index 4c29fa4..0729ff8 100644
--- a/src/deliverable.c
+++ b/src/deliverable.c
@@ -752,9 +752,11 @@ int delivery_init(struct Delivery *ctx) {
}
}
- if (docker_validate_compression_program(ctx->deploy.docker.image_compression)) {
- SYSERROR("[deploy:docker].image_compression - invalid command / program is not installed: %s", ctx->deploy.docker.image_compression);
- return -1;
+ if (ctx->deploy.docker.image_compression) {
+ if (docker_validate_compression_program(ctx->deploy.docker.image_compression)) {
+ SYSERROR("[deploy:docker].image_compression - invalid command / program is not installed: %s", ctx->deploy.docker.image_compression);
+ return -1;
+ }
}
return 0;
}
diff --git a/src/main.c b/src/main.c
index 7c20ae7..9e35240 100644
--- a/src/main.c
+++ b/src/main.c
@@ -580,11 +580,17 @@ int main(int argc, char *argv[]) {
msg(OMC_MSG_L1, "Rendering mission templates\n");
delivery_mission_render_files(&ctx);
+ char dockerfile[PATH_MAX] = {0};
+ sprintf(dockerfile, "%s/%s", ctx.storage.build_docker_dir, "Dockerfile");
if (globals.enable_docker) {
- msg(OMC_MSG_L1, "Building Docker image\n");
- if (delivery_docker(&ctx)) {
- msg(OMC_MSG_L1 | OMC_MSG_ERROR, "Failed to build docker image!\n");
- COE_CHECK_ABORT(1, "Failed to build docker image");
+ if (!access(dockerfile, F_OK)) {
+ msg(OMC_MSG_L1, "Building Docker image\n");
+ if (delivery_docker(&ctx)) {
+ msg(OMC_MSG_L1 | OMC_MSG_ERROR, "Failed to build docker image!\n");
+ COE_CHECK_ABORT(1, "Failed to build docker image");
+ }
+ } else {
+ msg(OMC_MSG_L1 | OMC_MSG_WARN, "Docker image building is disabled. No Dockerfile found in %s\n", ctx.storage.build_docker_dir);
}
} else {
msg(OMC_MSG_L1 | OMC_MSG_WARN, "Docker image building is disabled\n");