FaaS does Cobol :-)

This commit is contained in:
Alex Ellis 2017-05-04 17:40:04 +01:00
parent 42ce8ed0b3
commit c05aee101c
4 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,15 @@
FROM toricls/gnucobol:latest
ADD https://github.com/alexellis/faas/releases/download/0.5.1-alpha/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
WORKDIR /root/
COPY handler.cob .
RUN cobc -x handler.cob
ENV fprocess="./handler"
HEALTHCHECK --interval=1s CMD [ -e /tmp/.lock ] || exit 1
CMD ["fwatchdog"]

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "Building functions/base:cobol"
docker build -t functions/base:cobol .

View File

@ -0,0 +1,38 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. APP.
*> Example based upon http://stackoverflow.com/q/938760/1420197
*> More on COBOL @ https://www.ibm.com/support/knowledgecenter/en/SS6SG3_3.4.0/com.ibm.entcobol.doc_3.4/tpbeg15.htm
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SYSIN ASSIGN TO KEYBOARD ORGANIZATION LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD SYSIN.
01 ln PIC X(64).
88 EOF VALUE HIGH-VALUES.
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
DISPLAY "Request data: "
DISPLAY "------------"
OPEN INPUT SYSIN
READ SYSIN
AT END SET EOF TO TRUE
END-READ
PERFORM UNTIL EOF
DISPLAY ln
READ SYSIN
AT END SET EOF TO TRUE
END-READ
END-PERFORM
CLOSE SYSIN
DISPLAY "------------"
STOP RUN.

View File

@ -0,0 +1,6 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'FaaS running COBOL in a container!'.
STOP RUN.