From 2693c1692be5dff0e56eed6d3d0b697236ebc29e Mon Sep 17 00:00:00 2001 From: silvioprog Date: Thu, 8 Feb 2024 00:04:30 -0300 Subject: [PATCH] Add simple example for how to run Sagui inside a container --- .dockerignore | 7 +++++++ Dockerfile | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ea2a5b3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.github/ +build/ +docs/ +lib/ +_config.yml +ChangeLog +Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6625a84 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +###################################################################### +# Copyright (c) 2024 Silvio Clecio (silvioprog) +# +# SPDX-License-Identifier: MIT +###################################################################### + +# podman build --platform linux/amd64 -t hello_sagui . +# podman run --platform linux/amd64 --rm -it -p 8080:8080 hello_sagui + +FROM alpine:3.19.1 AS builder + +RUN apk add --no-cache \ + make \ + autoconf \ + automake \ + clang \ + cmake + +WORKDIR /app + +COPY . /app/ + +RUN mkdir build && \ + cd build/ && \ + cmake -DBUILD_SHARED_LIBS=OFF .. && \ + make example_httpsrv +RUN strip /app/build/examples/example_httpsrv + +FROM scratch +WORKDIR /app +COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 +COPY --from=builder /app/build/examples/example_httpsrv . +ENTRYPOINT ["./example_httpsrv", "8080"]