diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ef618eb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +Dockerfile +.git +.gitignore +dist/** +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c6fff9d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,50 @@ +# FROM ubuntu:24.04 + +# ADD ./loader/loader-crm /etc/cron.d/loader-crm +# RUN chmod 0644 /etc/cron/loader-crm +# RUN touch /var/log/chron.log + +# RUN apt-get update +# RUN apt-get -y install cron +# RUN systemctl enable cron + +# Setup the loader +FROM python:3.12 +COPY ./loader /srv/cprush-stats +WORKDIR /srv/cprush-stats +RUN python -m pip install --upgrade pip +RUN pip install -r requirements.txt + +CMD ["python3", "createrushdatabase.py"] + +FROM node:23 + +COPY --from=0 /srv/cprush-stats /srv/cprush-stats + +RUN corepack enable + +# build the frontend +COPY ./frontend /frontend +WORKDIR /frontend +RUN npm install +RUN npm run build +RUN mkdir -p /srv/cprush-stats/frontend +RUN cp -rf ./dist/* /srv/cprush-stats/frontend + +# build the backend +COPY ./backend /backend +WORKDIR /backend +RUN npm install +RUN npm run build +RUN mkdir -p /srv/cprush-stats +RUN cp -rf ./dist/* /srv/cprush-stats +RUN cp package.json /srv/cprush-stats/package.json + +WORKDIR loader + +EXPOSE 3001 +ENV NODE_ENV=production + +WORKDIR /srv/cprush-stats +RUN npm install +CMD ["node", "app.js"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..272b291 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,5 @@ +services: + cprush: + image: potato + ports: + - 3001:3001 diff --git a/loader/loader-crm b/loader/loader-crm new file mode 100644 index 0000000..3c0852d --- /dev/null +++ b/loader/loader-crm @@ -0,0 +1 @@ +*/10 * * * * python3 /loader/createrushdatabase.py \ No newline at end of file