-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
40 lines (31 loc) · 1.05 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM docker.io/library/ubuntu:oracular AS base
WORKDIR /app
# --- BUILD STAGE ---
FROM base AS build
# Install build dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
gcc g++ make gnucobol3 zlib1g-dev curl openjdk-21-jre-headless && \
rm -rf /var/lib/apt/lists/*
# Perform data extraction first to allow Docker to cache this layer
COPY Makefile .
RUN make data
# Copy source files and build
COPY main.cob .
COPY src ./src
COPY cpp ./cpp
RUN make -j $(nproc) GCVERSION=32
# --- DEPLOY STAGE ---
FROM base AS deploy
# Install runtime dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libcob4 zlib1g tini && \
rm -rf /var/lib/apt/lists/*
# Copy the build results
COPY --from=build /app/cobolcraft .
COPY --from=build /app/data/generated/reports/*.json ./data/generated/reports/
COPY --from=build /app/data/generated/data ./data/generated/data
# Run the server within Tini (to handle signals properly)
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/app/cobolcraft"]