2022-05-19 12:29:59 +03:00
|
|
|
# syntax=docker/dockerfile:1
|
2023-09-03 21:38:54 +03:00
|
|
|
FROM node:18-slim AS builder
|
2022-05-19 12:29:59 +03:00
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Set Working Directory
|
2022-05-19 12:29:59 +03:00
|
|
|
WORKDIR /app
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Add `/app/node_modules/.bin` to $PATH
|
2022-05-19 12:29:59 +03:00
|
|
|
ENV PATH /app/node_modules/.bin:$PATH
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Install UI Dependencies
|
2022-05-19 12:29:59 +03:00
|
|
|
COPY ./ui/package.json ./
|
|
|
|
COPY ./ui/package-lock.json ./
|
|
|
|
|
|
|
|
RUN npm install
|
|
|
|
RUN chmod 777 node_modules
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Copy UI Code
|
2022-05-19 12:29:59 +03:00
|
|
|
COPY ./ui/. ./
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Build IPAM UI
|
2022-05-19 12:29:59 +03:00
|
|
|
RUN npm run build
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
FROM python:3.9-slim
|
2022-04-08 22:05:52 +03:00
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Set Working Directory
|
2022-05-19 12:29:59 +03:00
|
|
|
WORKDIR /tmp
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Install OpenSSH and set the password for root to "Docker!"
|
|
|
|
RUN apt update
|
|
|
|
RUN apt install openssh-server -y \
|
|
|
|
&& echo "root:Docker!" | chpasswd
|
|
|
|
|
|
|
|
# Enable SSH root login with Password Authentication
|
2022-05-23 09:09:47 +03:00
|
|
|
# RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
|
|
|
|
|
|
|
# Copy 'sshd_config File' to /etc/ssh/
|
|
|
|
COPY sshd_config /etc/ssh/
|
2022-05-20 11:08:55 +03:00
|
|
|
|
|
|
|
RUN ssh-keygen -A
|
|
|
|
RUN mkdir /var/run/sshd
|
|
|
|
|
|
|
|
# Install NodeJS 16.x
|
2022-05-23 09:09:47 +03:00
|
|
|
RUN apt install curl -y
|
2023-09-03 21:38:54 +03:00
|
|
|
RUN curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
|
2022-05-19 12:29:59 +03:00
|
|
|
RUN bash ./nodesource_setup.sh
|
|
|
|
RUN apt install nodejs
|
|
|
|
RUN npm install -g react-inject-env
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Set Working Directory
|
2022-04-08 22:05:52 +03:00
|
|
|
WORKDIR /code
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Install Engine Dependencies
|
2022-05-19 12:29:59 +03:00
|
|
|
COPY ./engine/requirements.txt /code/requirements.txt
|
2022-04-08 22:05:52 +03:00
|
|
|
|
2023-07-30 08:53:48 +03:00
|
|
|
# Upgrade PIP
|
2023-08-30 21:19:06 +03:00
|
|
|
RUN pip install --upgrade pip --progress-bar off
|
2023-07-30 08:53:48 +03:00
|
|
|
|
|
|
|
# Install Dependencies
|
2022-04-08 22:05:52 +03:00
|
|
|
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Copy Engine Code
|
2022-05-19 12:29:59 +03:00
|
|
|
COPY ./engine/app /code/app
|
|
|
|
COPY --from=builder /app/build ./app/build
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Copy Init Script
|
2022-05-19 12:29:59 +03:00
|
|
|
COPY ./init.sh /code
|
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Expose Ports
|
|
|
|
EXPOSE 80 2222
|
2022-04-08 22:05:52 +03:00
|
|
|
|
2022-05-20 11:08:55 +03:00
|
|
|
# Execute Init Script
|
2022-05-19 12:29:59 +03:00
|
|
|
CMD ["bash", "./init.sh"]
|
2022-05-20 11:08:55 +03:00
|
|
|
|
|
|
|
# CMD npx --yes react-inject-env set -d /code/app/build ; uvicorn "app.main:app" --reload --host "0.0.0.0" --port 80
|