Nantes Université

Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider a3d373bf rédigé par Andrej Podhradsky's avatar Andrej Podhradsky Validation de GitHub
Parcourir les fichiers

Containerize the pict tool (#114)


Signed-off-by: default avatarAndrej Podhradsky <apodhrad@redhat.com>
parent b062e264
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# ____ _ _ _
# | __ ) _ _(_) | __| | ___ _ __
# | _ \| | | | | |/ _` |/ _ \ '__|
# | |_) | |_| | | | (_| | __/ |
# |____/ \__,_|_|_|\__,_|\___|_|
#
FROM registry.access.redhat.com/ubi9/toolbox:9.2 as builder
# This will be used in ubi-micro
RUN dnf --installroot=/tmp/ubi-micro \
--nodocs --setopt=install_weak_deps=False \
install -y \
g++ shadow-utils && \
dnf --installroot=/tmp/ubi-micro \
clean all
# This is needed to build pict
RUN dnf install -y cmake g++ && \
mkdir /tmp/pict
# Copy repo resources
COPY ./ /tmp/pict/
# Build the pict
RUN cd /tmp/pict/ && \
rm -rf build && \
cmake -DCMAKE_BUILD_TYPE=Release -S . -B build && \
cmake --build build && \
cp build/cli/pict /tmp/ubi-micro/usr/local/bin/
# __ __ _
# | \/ | __ _(_)_ __
# | |\/| |/ _` | | '_ \
# | | | | (_| | | | | |
# |_| |_|\__,_|_|_| |_|
#
FROM registry.access.redhat.com/ubi9/ubi-micro:9.2
COPY --from=builder /tmp/ubi-micro/ /
VOLUME /var/pict
WORKDIR /var/pict
RUN useradd -M pict
USER pict
ENTRYPOINT ["pict"]
......@@ -16,6 +16,7 @@ OBJS_CLI = cli/ccommon.o cli/cmdline.o
OBJS_CLI += cli/common.o cli/cparser.o cli/ctokenizer.o cli/gcd.o
OBJS_CLI += cli/gcdexcl.o cli/gcdmodel.o cli/model.o cli/mparser.o
OBJS_CLI += cli/pict.o cli/strings.o
IMAGE := pict:latest
pict: $(OBJS)
$(CXX) $(OBJS) -o $(TARGET)
......@@ -35,3 +36,9 @@ source: clean
git archive --prefix="pict-$(COMMIT)/" -o "pict-$(SHORT_COMMIT).tar.gz" $(COMMIT)
.PHONY: all test clean source
image-build:
@podman build --layers=true -t $(IMAGE) .
image-run:
@podman run -it --rm -v ./doc/sample-models:/var/pict:Z $(IMAGE) create_volume.txt
......@@ -54,3 +54,18 @@ Assuming installation of CMake and C++ toolchain, following set of commands will
## Debugging
Most commonly, you will want to debug the command-line tool. Start in the **pictcli** project, **cli/pict.cpp** file. You'll find **wmain** routine there which would be a convenient place to put the very first breakpoint.
## PICT as a container
To build a container image with PICT, just execute
make image-build
Once built, you can run it with a sample model as follows
make image-run
To use your own models, please execute
podman run -it --rm -v ./<local-dir>:/var/pict:Z pict:latest <your-model-file> [<pict-options>]
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter