0

I want to build an app using swipl+bash+node.js.

I think that I want to use Docker (to avoid pathname issues).

Trying to apt-get install swipl with a simple script fails (at the interactive input stage (Geographic location)):


Dockerfile:

FROM ubuntu:latest
RUN   apt-get update && \
 printf 'Y\n2\n' | apt-get install swi-prolog

RUN   export PATH=/root/.local/bin:/usr/local/bin:/root/.local/bin:$PATH

COPY hello.pl ./
ENTRYPOINT /usr/local/bin/swipl -g 'consult("hello.pl").' -g 'hello.' -g 'halt.'

hello.pl

hello:-
    format("Hello from SWIPL",[]).
  • 1
    What's the actual prompt? Is it what's shown in [how can i pass arguments or bypass it in docker build process?](https://stackoverflow.com/questions/53079135/how-can-i-pass-arguments-or-bypass-it-in-docker-build-process), and if so, does the recommended solution of setting `DEBIAN_FRONTEND=noninteractive` help? – David Maze Nov 11 '21 at 16:16
  • ``` => => # questions will narrow this down by presenting a list of cities, representing => => # the time zones in which they are located. => => # 1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc => => # 2. America 5. Arctic 8. Europe 11. SystemV => => # 3. Antarctica 6. Asia 9. Indian 12. US => => # Geographic area: ``` – paul tarvydas Nov 11 '21 at 16:29

1 Answers1

0

Yes, David Maze's suggestion helped.

For the record, the finished versions are:


Dockerfile

FROM ubuntu:latest

## for apt to be noninteractive
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

## preseed tzdata, update package index, upgrade packages and install needed software
RUN echo "tzdata tzdata/Areas select America" > /tmp/preseed.txt ; \
    echo "tzdata tzdata/Zones/America select Toronto" >> /tmp/preseed.txt; \
    debconf-set-selections /tmp/preseed.txt && \
    apt-get update && \
    apt-get install -y tzdata
    
RUN   apt-get update && \
  apt-get install -y swi-prolog

RUN   export PATH=/root/.local/bin:/usr/local/bin:/root/.local/bin:$PATH
COPY hello.pl ./
ENTRYPOINT swipl -g 'consult("hello.pl").' -g 'hello.' -g 'halt.'

# docker build . --tag hellofromswipl
# docker run hellofromswipl

hello.pl

    get_time(T),
    format_time(user_output,'Hello from SWIPL %a, %d %b %Y %T GMT', T).