Browse Source

added express server container

Bachir Soussi Chiadmi 1 year ago
parent
commit
084e087a11
8 changed files with 55 additions and 0 deletions
  1. 3 0
      .gitmodules
  2. 24 0
      Docker/server/Dockerfile
  3. 3 0
      Docker/server/bashrc
  4. 11 0
      Docker/server/entrypoint.sh
  5. 2 0
      Docker/server/inputrc
  6. 3 0
      Makefile
  7. 8 0
      docker-compose.yml
  8. 1 0
      server

+ 3 - 0
.gitmodules

@@ -4,3 +4,6 @@
 [submodule "remote"]
 	path = remote
 	url = https://esadhar.net/gogs/bachir/offline-timeline-remote.git
+[submodule "server"]
+	path = server
+	url = https://esadhar.net/gogs/bachir/offline-timeline-server.git

+ 24 - 0
Docker/server/Dockerfile

@@ -0,0 +1,24 @@
+FROM node:lts-alpine
+
+RUN apk update && apk --no-cache add shadow && \
+    usermod -u 1001 node && \
+    groupmod -g 1001 node
+
+RUN find / -group 1000 -exec chgrp -h node {} \;
+RUN find / -user 1000 -exec chown -h node {} \;
+
+# RUN addgroup -g 1000 gdp && \
+    # adduser -h /home/gdp -D -u 1000 gdp && \
+RUN adduser -u 1000 -G users -s /bin/sh -D offline
+    # chown -R gdp:gdp /home/gdp
+
+USER offline
+
+COPY ./bashrc /home/offline/.bashrc
+COPY ./inputrc /home/offline/.inputrc
+
+COPY ./entrypoint.sh /usr/local/bin
+USER root
+RUN chmod +x /usr/local/bin/entrypoint.sh
+USER offline
+CMD ["/bin/sh","/usr/local/bin/entrypoint.sh"]

+ 3 - 0
Docker/server/bashrc

@@ -0,0 +1,3 @@
+PS1='\e[36m\e[1mNODE\e[0m:\e[90m\w\e[0m\n$ '
+bind '"\e[A": history-search-backward'
+bind '"\e[B": history-search-forward'

+ 11 - 0
Docker/server/entrypoint.sh

@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cat /etc/passwd|grep 1000
+
+echo "Npm install"
+
+cd /server
+npm install
+
+echo "Run server"
+npm run dev

+ 2 - 0
Docker/server/inputrc

@@ -0,0 +1,2 @@
+set show-all-if-ambiguous on
+set completion-ignore-case on

+ 3 - 0
Makefile

@@ -41,3 +41,6 @@ exec_app:
 
 exec_remote:
 		docker exec -it offline_timeline_remote_1 sh
+
+exec_server:
+		docker exec -it offline_timeline_server_1 sh

+ 8 - 0
docker-compose.yml

@@ -1,5 +1,13 @@
 version: '3.7'
 services:
+  server:
+    build: ./Docker/server
+    user: ${USER_UID}:${USER_GID}
+    volumes:
+      - "${SERVER_ROOT}:/server"
+    ports:
+      - 8987:8987
+    working_dir: "/server"
   app:
     build: ./Docker/app
     user: ${USER_UID}:${USER_GID}

+ 1 - 0
server

@@ -0,0 +1 @@
+Subproject commit 845483c22fe2f9d87f2cbed4b5c6364827f74de9