From 99e91324bc93ebe4070ad032762bb5b43e7542f0 Mon Sep 17 00:00:00 2001 From: dymik739 Date: Mon, 31 Mar 2025 19:50:26 +0300 Subject: [PATCH] add Dockerfile for building the container --- Dockerfile | 63 +++++++++++++++++++++++++++++++++++++++++++ daemon-files/hive-cc | 10 +++++++ daemon-files/hive-hm | 10 +++++++ daemon-files/hive-map | 15 +++++++++++ 4 files changed, 98 insertions(+) create mode 100644 Dockerfile create mode 100644 daemon-files/hive-cc create mode 100644 daemon-files/hive-hm create mode 100644 daemon-files/hive-map diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..055c315 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,63 @@ +# dotnet build environment +#FROM alpine:latest +#WORKDIR / + +#RUN apk add dotnet8-sdk git +#RUN git clone https://gitlab.com/kzotkin/hiveemulator + +#WORKDIR /hiveemulator/src/CommunicationControl/ +#RUN dotnet build DevOpsProject/DevOpsProject.CommunicationControl.API.csproj +#RUN dotnet build DevOpsProject.HiveMind.API/DevOpsProject.HiveMind.API.csproj + + +# nodejs build environment +#FROM alpine:latest as nodejs +#WORKDIR / + +#RUN apk add git npm +#RUN git clone https://gitlab.com/kzotkin/hiveemulator + +#WORKDIR /hiveemulator/src/MapClient/ +#RUN npm install +#RUN npm run build + + +# production environment +FROM alpine:latest +WORKDIR / + +#RUN apk add dotnet8-sdk redis openrc lighttpd npm +RUN apk add git dotnet8-sdk redis openrc npm + +RUN git clone https://gitlab.com/kzotkin/hiveemulator +#COPY --from=nodejs /hiveemulator/ /hiveemulator/ +#COPY --from=nodejs /hiveemulator/src/MapClient/dist/* /var/www/localhost/htdocs/ + +#RUN mkdir /hive-cc +#COPY --from=0 /hiveemulator/src/CommunicationControl/DevOpsProject/* /hive-cc/ + +#RUN mkdir /hive-hm +#COPY --from=0 /hiveemulator/src/CommunicationControl/DevOpsProject.HiveMind.API/* /hive-hm/ + +WORKDIR /hiveemulator/src/MapClient/ +RUN npm install +RUN sed -i 's/localhost/10\.1\.1\.2/' public/config.json + +COPY ./daemon-files/hive-cc /etc/init.d/hive-cc +COPY ./daemon-files/hive-hm /etc/init.d/hive-hm +COPY ./daemon-files/hive-map /etc/init.d/hive-map +RUN chmod u+x /etc/init.d/hive-hm /etc/init.d/hive-cc /etc/init.d/hive-map + +#RUN mkdir /etc/rulevels/{stage-redis,stage-cc,stage-hm,stage-map} + +#RUN rc-update add redis default +#RUN rc-update add hive-hm default +#RUN rc-update add hive-cc default +#RUN rc-update add hive-map default + +CMD sh -c "openrc default ; \ + rc-service redis start ; \ + rc-service hive-cc start ; \ + rc-service hive-hm start ; \ + rc-service hive-map start ; \ + exec sh" diff --git a/daemon-files/hive-cc b/daemon-files/hive-cc new file mode 100644 index 0000000..188c826 --- /dev/null +++ b/daemon-files/hive-cc @@ -0,0 +1,10 @@ +#!/sbin/openrc-run + +command="/usr/bin/dotnet" +command_args="run --project /hiveemulator/src/CommunicationControl/DevOpsProject/DevOpsProject.CommunicationControl.API.csproj" +pidfile="/run/hive-cc.pid" +supervisor="supervise-daemon" + +depend() { + need redis +} diff --git a/daemon-files/hive-hm b/daemon-files/hive-hm new file mode 100644 index 0000000..891be3e --- /dev/null +++ b/daemon-files/hive-hm @@ -0,0 +1,10 @@ +#!/sbin/openrc-run + +command="/usr/bin/dotnet" +command_args="run --project /hiveemulator/src/CommunicationControl/DevOpsProject.HiveMind.API/DevOpsProject.HiveMind.API.csproj" +pidfile="/run/hive-hm.pid" +supervisor="supervise-daemon" + +depend() { + need hive-cc +} diff --git a/daemon-files/hive-map b/daemon-files/hive-map new file mode 100644 index 0000000..20b1dcd --- /dev/null +++ b/daemon-files/hive-map @@ -0,0 +1,15 @@ +#!/sbin/openrc-run + +command="npm" +command_args="run dev" +pidfile="/run/hive-map.pid" +supervisor="supervise-daemon" + +depend() { + need hive-cc +} + +start() { + cd /hiveemulator/src/MapClient/ + ${command} ${command_args} +}