feat: adiciona Dockerfile e integração com CI/CD
- Adiciona Dockerfile multi-stage usando Oracle Linux 9 - Instala Oracle Instant Client via RPM - Adiciona .dockerignore para otimizar builds - Integra build Docker no GitHub Actions CI - Configura push automático para GitHub Container Registry
This commit is contained in:
61
Dockerfile
Normal file
61
Dockerfile
Normal file
@@ -0,0 +1,61 @@
|
||||
FROM oraclelinux:9 AS base
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN dnf install -y \
|
||||
curl \
|
||||
libaio \
|
||||
&& curl -fsSL https://rpm.nodesource.com/setup_20.x | bash - \
|
||||
&& dnf install -y nodejs \
|
||||
&& dnf clean all
|
||||
|
||||
FROM base AS dependencies
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm ci --only=production && npm cache clean --force
|
||||
|
||||
FROM base AS build
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM base AS production
|
||||
|
||||
RUN dnf install -y \
|
||||
curl \
|
||||
libaio \
|
||||
&& dnf clean all
|
||||
|
||||
ENV ORACLE_CLIENT_LIB_DIR=/usr/lib/oracle/21/client64/lib
|
||||
|
||||
RUN curl -fSL --cookie-jar /tmp/cookies.txt --retry 3 \
|
||||
"https://download.oracle.com/otn_software/linux/instantclient/2112000/el9/oracle-instantclient-basiclite-21.12.0.0.0-1.el9.x86_64.rpm" \
|
||||
--output /tmp/oracle-instantclient-basiclite.rpm && \
|
||||
dnf install -y /tmp/oracle-instantclient-basiclite.rpm && \
|
||||
rm -f /tmp/oracle-instantclient-basiclite.rpm /tmp/cookies.txt && \
|
||||
dnf clean all
|
||||
|
||||
ENV LD_LIBRARY_PATH=/usr/lib/oracle/21/client64/lib:$LD_LIBRARY_PATH
|
||||
ENV TZ=America/Sao_Paulo
|
||||
|
||||
RUN groupadd -r node && useradd -r -g node node
|
||||
|
||||
COPY --from=dependencies /app/node_modules ./node_modules
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY --from=build /app/package*.json ./
|
||||
COPY --from=build /app/cert ./cert
|
||||
|
||||
RUN chown -R node:node /app
|
||||
|
||||
EXPOSE 8066
|
||||
|
||||
USER node
|
||||
|
||||
CMD ["node", "dist/main"]
|
||||
|
||||
Reference in New Issue
Block a user