|
| 1 | +# Build stage |
| 2 | +FROM almalinux:9 AS builder |
| 3 | + |
| 4 | +SHELL ["/bin/bash", "-c"] |
| 5 | + |
| 6 | +# install build dependencies |
| 7 | +RUN dnf update -y && \ |
| 8 | + dnf install -y gcc make bison flex automake autoconf diffutils gettext java-11-openjdk-devel && \ |
| 9 | + dnf clean all |
| 10 | + |
| 11 | +# install sbt |
| 12 | +RUN curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && \ |
| 13 | + chmod +x cs && \ |
| 14 | + echo Y | ./cs setup |
| 15 | + |
| 16 | +# build opensourcecobol4j |
| 17 | +RUN cd /root && \ |
| 18 | + curl -L -o opensourcecobol4j-v1.1.7.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.1.7.tar.gz && \ |
| 19 | + tar zxvf opensourcecobol4j-v1.1.7.tar.gz && \ |
| 20 | + cd opensourcecobol4j-1.1.7 && \ |
| 21 | + ./configure --prefix=/usr/ && \ |
| 22 | + make && \ |
| 23 | + make install DESTDIR=/tmp/install && \ |
| 24 | + rm -rf /root/opensourcecobol4j-v1.1.7.tar.gz /root/opensourcecobol4j-1.1.7 |
| 25 | + |
| 26 | +# Download postgresql jar |
| 27 | +RUN mkdir -p /tmp/install/usr/lib/Open-COBOL-ESQL-4j/ && \ |
| 28 | + curl -L -o /tmp/install/usr/lib/Open-COBOL-ESQL-4j/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.2.24.jar |
| 29 | + |
| 30 | +# Build Open COBOL ESQL 4J |
| 31 | +ENV PATH="$PATH:/root/.local/share/coursier/bin" |
| 32 | +RUN cd /root/ && \ |
| 33 | + curl -L -o Open-COBOL-ESQL-4j-1.1.1.tar.gz https://github.com/opensourcecobol/Open-COBOL-ESQL-4j/archive/refs/tags/v1.1.1.tar.gz && \ |
| 34 | + tar zxvf Open-COBOL-ESQL-4j-1.1.1.tar.gz && \ |
| 35 | + cd Open-COBOL-ESQL-4j-1.1.1 && \ |
| 36 | + cp /tmp/install/usr/lib/opensourcecobol4j/libcobj.jar dblibj/lib && \ |
| 37 | + cp /tmp/install/usr/lib/Open-COBOL-ESQL-4j/postgresql.jar dblibj/lib && \ |
| 38 | + ./configure --prefix=/usr/ && \ |
| 39 | + make && \ |
| 40 | + make install DESTDIR=/tmp/install && \ |
| 41 | + rm -rf /root/Open-COBOL-ESQL-4j-1.1.1.tar.gz /root/Open-COBOL-ESQL-4j-1.1.1 |
| 42 | + |
| 43 | +# Runtime stage |
1 | 44 | FROM almalinux:9 |
2 | 45 |
|
3 | 46 | SHELL ["/bin/bash", "-c"] |
4 | 47 |
|
| 48 | +# install runtime dependencies only |
| 49 | +RUN dnf update -y && \ |
| 50 | + dnf install -y java-11-openjdk-headless && \ |
| 51 | + dnf clean all && \ |
| 52 | + rm -rf /var/cache/dnf/* |
| 53 | + |
| 54 | +# copy built files from builder stage |
| 55 | +COPY --from=builder /tmp/install/usr/ /usr/ |
| 56 | + |
5 | 57 | # classpath settings |
6 | 58 | ENV CLASSPATH=:/usr/lib/opensourcecobol4j/libcobj.jar:/usr/lib/Open-COBOL-ESQL-4j/postgresql.jar:/usr/lib/opensourcecobol4j/ocesql4j.jar |
7 | 59 | RUN echo 'export CLASSPATH=:/usr/lib/opensourcecobol4j/libcobj.jar:/usr/lib/Open-COBOL-ESQL-4j/postgresql.jar:/usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar' >> ~/.bashrc |
8 | 60 |
|
9 | | -# install dependencies |
10 | | -RUN dnf update -y |
11 | | -RUN dnf install -y gcc make bison flex automake autoconf diffutils gettext java-11-openjdk-devel |
12 | | - |
13 | | -# install sbt |
14 | | -RUN curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && echo Y | ./cs setup |
15 | | - |
16 | | -# install opensourcecobol4j |
17 | | -RUN cd /root &&\ |
18 | | - curl -L -o opensourcecobol4j-v1.1.7.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.1.7.tar.gz &&\ |
19 | | - tar zxvf opensourcecobol4j-v1.1.7.tar.gz &&\ |
20 | | - cd opensourcecobol4j-1.1.7 &&\ |
21 | | - ./configure --prefix=/usr/ &&\ |
22 | | - make &&\ |
23 | | - make install &&\ |
24 | | - rm /root/opensourcecobol4j-v1.1.7.tar.gz |
25 | | - |
26 | | -# Install Open COBOL ESQL 4J |
27 | | -ENV PATH="$PATH:/root/.local/share/coursier/bin" |
28 | | -RUN mkdir -p /usr/lib/Open-COBOL-ESQL-4j &&\ |
29 | | - cd /root/ &&\ |
30 | | - curl -L -o Open-COBOL-ESQL-4j-1.1.1.tar.gz https://github.com/opensourcecobol/Open-COBOL-ESQL-4j/archive/refs/tags/v1.1.1.tar.gz &&\ |
31 | | - tar zxvf Open-COBOL-ESQL-4j-1.1.1.tar.gz &&\ |
32 | | - rm Open-COBOL-ESQL-4j-1.1.1.tar.gz &&\ |
33 | | - cd Open-COBOL-ESQL-4j-1.1.1 &&\ |
34 | | - mkdir -p /usr/lib/Open-COBOL-ESQL-4j/ &&\ |
35 | | - curl -L -o /usr/lib/Open-COBOL-ESQL-4j/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.2.24.jar &&\ |
36 | | - cp /usr/lib/opensourcecobol4j/libcobj.jar dblibj/lib &&\ |
37 | | - cp /usr/lib/Open-COBOL-ESQL-4j/postgresql.jar dblibj/lib &&\ |
38 | | - ./configure --prefix=/usr/ &&\ |
39 | | - make &&\ |
40 | | - make install &&\ |
41 | | - rm -rf /root/Open-COBOL-ESQL-4j-1.1.1 |
42 | | - |
43 | 61 | # add sample programs |
44 | 62 | ADD cobol_sample /root/cobol_sample |
45 | 63 | ADD ocesql4j_sample /root/ocesql4j_sample |
|
0 commit comments