Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dsaul committed May 26, 2023
1 parent cafa887 commit e645405
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 6,326 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
/docker/callcontrol/asterisk/_holdmusic/on1.wav
/frontend/.quasar
/frontend/node_modules
/frontend/yarn.lock
/frontend/yarn.lock
/frontend/package-lock.json
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2.0'
services:
ananaphone:
build:
context: ./
context: ../
dockerfile: ./dockerfile.txt
container_name: ananaphone
restart: always
Expand Down
188 changes: 95 additions & 93 deletions docker/dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,108 +4,110 @@ FROM debian:bookworm as buildFrontend
RUN apt-get update && apt-get install -y \
openssh-client \
bash \
ca-certificates \
git \
curl \
sudo \
nodejs \
npm \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*

RUN npm install --global yarn
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts
ADD ../frontend /source
ADD ./frontend /source
WORKDIR /source
RUN ls -lR
RUN yarn install && yarn build

# Stage 2 - api & web server
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS buildBackend

# Add packages we need.
RUN apt-get update && apt-get install -y \
openssh-client \
bash \
ca-certificates \
git \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*

ADD ../backend /source
WORKDIR /source
RUN ls -la

RUN rm /source/AnanaPhone/wwwroot/index.html
COPY --from=buildFrontend /source/dist .

WORKDIR /source/backend/AnanaPhone
RUN dotnet restore && dotnet publish --output /app --configuration Debug

# STAGE 3 - Package
FROM mcr.microsoft.com/dotnet/aspnet:7.0

RUN mkdir -p /vmail
VOLUME /vmail
# sip
EXPOSE 5060/udp
EXPOSE 5060/tcp
# rtp
EXPOSE 5100-5200/udp
EXPOSE 5100-5200/tcp
# ami
EXPOSE 5038/tcp

# SSHD
EXPOSE 5039/tcp

RUN apt-get update && apt-get install -y \
openssh-client \
bash \
curl \
cron \
sudo \
asterisk \
htop \
sngrep \
dos2unix \
iproute2 \
inetutils-ping \
nano \
wget \
openssh-server \
&& rm -rf /var/lib/apt/lists/*

RUN rm -rf /etc/asterisk/ && \
mkdir -p /etc/asterisk/_holdmusic

# Setup SSHD
COPY includes/sshd/sshd_config /etc/ssh/sshd_config
RUN mkdir -p /root/.ssh/
COPY includes/sshd/authorized_keys /root/.ssh/authorized_keys
RUN dos2unix /etc/ssh/sshd_config \
&& dos2unix /root/.ssh/authorized_keys \
&& chmod 600 /root/.ssh/authorized_keys \
&& chmod 700 /root/.ssh

# Setup Cron
COPY includes/cron/cron15min.sh /cron15min.sh
COPY includes/cron/cronDaily.sh /cronDaily.sh
COPY includes/cron/cronHourly.sh /cronHourly.sh
COPY includes/cron/cronMonthly.sh /cronMonthly.sh
COPY includes/cron/cronWeekly.sh /cronWeekly.sh
COPY includes/cron/crontab.txt /crontab.txt
COPY includes/entry.sh /entry.sh

RUN dos2unix /cron15min.sh /cronDaily.sh /cronHourly.sh /cronMonthly.sh /cronWeekly.sh /entry.sh && \
chmod 755 /cron15min.sh /cronDaily.sh /cronHourly.sh /cronMonthly.sh /cronWeekly.sh /entry.sh && \
dos2unix /crontab.txt && crontab /crontab.txt

# Configure Asterisk
COPY includes/asterisk/ /etc/asterisk/
RUN dos2unix /etc/asterisk/* && \
dos2unix /etc/asterisk/extensions.d/* && \
dos2unix /etc/asterisk/manager.d/* && \
dos2unix /etc/asterisk/pjsip_wizard.d/*

CMD ["/entry.sh"]
# # Stage 2 - api & web server
# FROM mcr.microsoft.com/dotnet/sdk:7.0 AS buildBackend

# # Add packages we need.
# RUN apt-get update && apt-get install -y \
# openssh-client \
# bash \
# ca-certificates \
# git \
# && update-ca-certificates \
# && rm -rf /var/lib/apt/lists/*
# RUN mkdir -p /app
# ADD ./backend /source
# WORKDIR /source
# RUN ls -la

# RUN rm /source/backend/AnanaPhone/wwwroot/index.html
# COPY --from=buildFrontend /source/frontend/dist .

# WORKDIR /source/backend/AnanaPhone
# RUN dotnet restore && dotnet publish --output /app --configuration Debug

# # STAGE 3 - Package
# FROM mcr.microsoft.com/dotnet/aspnet:7.0

# # sip
# EXPOSE 5060/udp
# EXPOSE 5060/tcp
# # rtp
# EXPOSE 5100-5200/udp
# EXPOSE 5100-5200/tcp
# # ami
# EXPOSE 5038/tcp

# # SSHD
# EXPOSE 5039/tcp

# RUN mkdir -p /vmail
# VOLUME /vmail


# RUN apt-get update && apt-get install -y \
# openssh-client \
# bash \
# curl \
# cron \
# sudo \
# asterisk \
# htop \
# sngrep \
# dos2unix \
# iproute2 \
# inetutils-ping \
# nano \
# wget \
# openssh-server \
# && rm -rf /var/lib/apt/lists/*

# RUN rm -rf /etc/asterisk/ && \
# mkdir -p /etc/asterisk/_holdmusic

# # Setup SSHD
# COPY includes/sshd/sshd_config /etc/ssh/sshd_config
# RUN mkdir -p /root/.ssh/
# COPY includes/sshd/authorized_keys /root/.ssh/authorized_keys
# RUN dos2unix /etc/ssh/sshd_config \
# && dos2unix /root/.ssh/authorized_keys \
# && chmod 600 /root/.ssh/authorized_keys \
# && chmod 700 /root/.ssh

# # Setup Cron
# COPY includes/cron/cron15min.sh /cron15min.sh
# COPY includes/cron/cronDaily.sh /cronDaily.sh
# COPY includes/cron/cronHourly.sh /cronHourly.sh
# COPY includes/cron/cronMonthly.sh /cronMonthly.sh
# COPY includes/cron/cronWeekly.sh /cronWeekly.sh
# COPY includes/cron/crontab.txt /crontab.txt
# COPY includes/entry.sh /entry.sh

# RUN dos2unix /cron15min.sh /cronDaily.sh /cronHourly.sh /cronMonthly.sh /cronWeekly.sh /entry.sh && \
# chmod 755 /cron15min.sh /cronDaily.sh /cronHourly.sh /cronMonthly.sh /cronWeekly.sh /entry.sh && \
# dos2unix /crontab.txt && crontab /crontab.txt

# # Configure Asterisk
# COPY includes/asterisk/ /etc/asterisk/
# RUN dos2unix /etc/asterisk/* && \
# dos2unix /etc/asterisk/extensions.d/* && \
# dos2unix /etc/asterisk/manager.d/* && \
# dos2unix /etc/asterisk/pjsip_wizard.d/*

# COPY --from=buildBackend /app /app


# CMD ["/entry.sh"]
Loading

0 comments on commit e645405

Please sign in to comment.