bitb0x/roles/apps/templates/rtl/Containerfile.j2

50 lines
1.1 KiB
Django/Jinja

# Install Dependencies
# ---------------
FROM docker.io/almalinux/9-base as builder
WORKDIR /RTL
RUN dnf update -y \
&& dnf module -y enable nodejs:18 \
&& dnf install -y nodejs git \
&& git clone https://github.com/Ride-The-Lightning/RTL.git . \
&& git checkout tags/v0.15.0 \
&& npm install
# ---------------
# Build App
# ---------------
# Build the Angular application
RUN npm run buildfrontend
# Build the Backend from typescript server
RUN npm run buildbackend
# Remove non production necessary modules
RUN npm prune --production
# ---------------
# Release App
# ---------------
FROM docker.io/almalinux/9-init
RUN printf "tsflags=nodocs\n" >>/etc/dnf/dnf.conf \
&& dnf update -y \
&& dnf module -y enable nodejs:18 \
&& dnf install -y nodejs \
&& dnf clean all \
&& rm -rf /var/cache/* /var/log* /tmp/*
WORKDIR /RTL
COPY --from=builder /RTL/rtl.js ./rtl.js
COPY --from=builder /RTL/package.json ./package.json
COPY --from=builder /RTL/frontend ./frontend
COPY --from=builder /RTL/backend ./backend
COPY --from=builder /RTL/node_modules/ ./node_modules
EXPOSE 3000
CMD ["node", "rtl"]