Skip to content

Commit 0d39664

Browse files
change: introduce multi stage builds into utf8.Dockerfile
1 parent e495f99 commit 0d39664

File tree

3 files changed

+58
-25
lines changed

3 files changed

+58
-25
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ ENV PATH="$PATH:/root/.local/share/coursier/bin"
1818

1919
# Build opensourcecobol4j
2020
RUN cd /tmp && \
21-
curl -L -o opensourcecobol4j-v1.1.7.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.1.7.tar.gz && \
22-
tar zxf opensourcecobol4j-v1.1.7.tar.gz && \
23-
cd opensourcecobol4j-1.1.7 && \
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 && \
2424
./configure --prefix=/usr/ && \
2525
make && \
2626
make install
@@ -61,7 +61,7 @@ COPY --from=builder /usr/bin/ocesql4j /usr/bin/
6161
COPY --from=builder /usr/lib/opensourcecobol4j/ /usr/lib/opensourcecobol4j/
6262
COPY --from=builder /usr/lib/Open-COBOL-ESQL-4j/ /usr/lib/Open-COBOL-ESQL-4j/
6363
# Copy configuration and copy files
64-
COPY --from=builder /usr/share/opensource-cobol-4j-1.1.8-hotfix1/ /usr/share/opensource-cobol-4j-1.1.8-hotfix1/
64+
COPY --from=builder /usr/share/opensource-cobol-4j-1.1.9/ /usr/share/opensource-cobol-4j-1.1.9/
6565
# Copy header file
6666
COPY --from=builder /usr/include/libcobj.h /usr/include/
6767

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# opensource COBOL 4J development environment (Docker)
22

33
## Docker image
4+
45
Versions :
56

67
- OS: Ubuntu
7-
- opensource COBOL 4J: v1.1.7
8+
- opensource COBOL 4J: v1.1.9
89
- Open COBOL ESQL 4J: v1.1.1
910

1011
In order to "Hello World" program, run the following commands in the docker container

utf8.Dockerfile

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,64 @@
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
130
FROM almalinux:9
231

332
SHELL ["/bin/bash", "-c"]
433

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
654
ENV CLASSPATH=:/usr/lib/opensourcecobol4j/libcobj.jar
755
RUN echo 'export CLASSPATH=:/usr/lib/opensourcecobol4j/libcobj.jar' >> ~/.bashrc
856

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
2858
ADD cobol_sample /root/cobol_sample
2959

3060
WORKDIR /root/
3161

3262
CMD ["/bin/bash"]
63+
64+
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)