|
| 1 | +# Builder 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 curl gzip tar && \ |
| 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 | +# Set PATH for sbt |
| 17 | +ENV PATH="$PATH:/root/.local/share/coursier/bin" |
| 18 | + |
| 19 | +# Build opensourcecobol4j with UTF-8 support |
| 20 | +RUN cd /tmp && \ |
| 21 | + curl -L -o opensourcecobol4j-v1.1.9.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.1.9.tar.gz && \ |
| 22 | + tar zxf opensourcecobol4j-v1.1.9.tar.gz && \ |
| 23 | + cd opensourcecobol4j-1.1.9 && \ |
| 24 | + ./configure --prefix=/usr/ --enable-utf8 && \ |
| 25 | + touch cobj/*.m4 && \ |
| 26 | + make && \ |
| 27 | + make install |
| 28 | + |
| 29 | +# Runtime stage |
1 | 30 | FROM almalinux:9
|
2 | 31 |
|
3 | 32 | SHELL ["/bin/bash", "-c"]
|
4 | 33 |
|
5 |
| -# classpath settings |
| 34 | +# Install only runtime dependencies |
| 35 | +RUN dnf update -y && \ |
| 36 | + dnf install -y java-11-openjdk-headless && \ |
| 37 | + dnf clean all |
| 38 | + |
| 39 | +# Copy installed files from builder |
| 40 | +# Copy opensourcecobol4j executables |
| 41 | +COPY --from=builder /usr/bin/cobj /usr/bin/ |
| 42 | +COPY --from=builder /usr/bin/cobjrun /usr/bin/ |
| 43 | +COPY --from=builder /usr/bin/cob-config /usr/bin/ |
| 44 | +COPY --from=builder /usr/bin/cobj-idx /usr/bin/ |
| 45 | +COPY --from=builder /usr/bin/cobj-api /usr/bin/ |
| 46 | +# Copy JAR libraries |
| 47 | +COPY --from=builder /usr/lib/opensourcecobol4j/ /usr/lib/opensourcecobol4j/ |
| 48 | +# Copy configuration and copy files |
| 49 | +COPY --from=builder /usr/share/opensource-cobol-4j-1.1.9/ /usr/share/opensource-cobol-4j-1.1.9/ |
| 50 | +# Copy header file |
| 51 | +COPY --from=builder /usr/include/libcobj.h /usr/include/ |
| 52 | + |
| 53 | +# Set classpath |
6 | 54 | ENV CLASSPATH=:/usr/lib/opensourcecobol4j/libcobj.jar
|
7 | 55 | RUN echo 'export CLASSPATH=:/usr/lib/opensourcecobol4j/libcobj.jar' >> ~/.bashrc
|
8 | 56 |
|
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/ --enable-utf8 &&\ |
22 |
| - touch cobj/*.m4 &&\ |
23 |
| - make &&\ |
24 |
| - make install &&\ |
25 |
| - rm /root/opensourcecobol4j-v1.1.7.tar.gz |
26 |
| - |
27 |
| -# add sample programs |
| 57 | +# Add sample programs |
28 | 58 | ADD cobol_sample /root/cobol_sample
|
29 | 59 |
|
30 | 60 | WORKDIR /root/
|
31 | 61 |
|
32 | 62 | CMD ["/bin/bash"]
|
| 63 | + |
| 64 | +CMD ["/bin/bash"] |
0 commit comments