Переглянути джерело

[release] v0.5.12-unstable

Yann Stepienik 2 роки тому
батько
коміт
7a3032de08
7 змінених файлів з 138 додано та 65 видалено
  1. 70 0
      .circleci/config.yml
  2. 2 0
      docker.arm64.sh
  3. 2 0
      docker.sh
  4. 9 32
      dockerfile
  5. 11 32
      dockerfile.arm64
  6. 43 0
      dockerfile.local
  7. 1 1
      package.json

+ 70 - 0
.circleci/config.yml

@@ -11,7 +11,38 @@ jobs:
           name: install dependencies
           command: sudo apt-get install bash curl
 
+      - run:
+          name: download Go
+          command: wget https://golang.org/dl/go1.20.2.linux-amd64.tar.gz
+      
+      - run:
+          name: install Go
+          command: sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz
+      
+      - run:
+          name: set Go path
+          command: echo 'export PATH=$PATH:/usr/local/go/bin' >> $BASH_ENV
+
+      - run: |
+            echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
+            echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
+     
+      - run: |
+          node -v
+
+      - run: |
+          nvm install v16
+          node -v
+          nvm alias default v16
+
+      - run: |
+          node -v
+
       - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
+
+      - run:
+          name: Install dependencies
+          command: npm install
           
       - run:
           name: Download GeoLite2-Country database
@@ -19,6 +50,10 @@ jobs:
             curl -s -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=$MAX_TOKEN&suffix=tar.gz" -o GeoLite2-Country.tar.gz
             tar -xzf GeoLite2-Country.tar.gz --strip-components 1 --wildcards "*.mmdb"
 
+      - run:
+          name: Build UI
+          command: npm run client-build
+
       - run:
           name: Build and publish dockerfiles
           command: sh docker.sh
@@ -35,7 +70,38 @@ jobs:
           name: install dependencies
           command: sudo apt-get install bash curl
 
+      - run:
+          name: download Go
+          command: wget https://golang.org/dl/go1.20.2.linux-arm64.tar.gz
+      
+      - run:
+          name: install Go
+          command: sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.2.linux-arm64.tar.gz
+      
+      - run:
+          name: set Go path
+          command: echo 'export PATH=$PATH:/usr/local/go/bin' >> $BASH_ENV
+
+      - run: |
+            echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
+            echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
+     
+      - run: |
+          node -v
+
+      - run: |
+          nvm install v16
+          node -v
+          nvm alias default v16
+
+      - run: |
+          node -v
+
       - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
+
+      - run:
+          name: Install dependencies
+          command: npm install
           
       - run:
           name: Download GeoLite2-Country database
@@ -43,6 +109,10 @@ jobs:
             curl -s -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=$MAX_TOKEN&suffix=tar.gz" -o GeoLite2-Country.tar.gz
             tar -xzf GeoLite2-Country.tar.gz --strip-components 1 --wildcards "*.mmdb"
 
+      - run:
+          name: Build UI
+          command: npm run client-build
+
       - run:
           name: Build and publish dockerfiles
           command: sh docker.arm64.sh

+ 2 - 0
docker.arm64.sh

@@ -12,6 +12,8 @@ fi
 
 echo "Pushing azukaar/cosmos-server:$VERSION and azukaar/cosmos-server:$LATEST"
 
+sh build.arm64.sh
+
 docker build \
   -t azukaar/cosmos-server:$VERSION-arm64 \
   -t azukaar/cosmos-server:$LATEST-arm64 \

+ 2 - 0
docker.sh

@@ -12,6 +12,8 @@ fi
 
 echo "Pushing azukaar/cosmos-server:$VERSION and azukaar/cosmos-server:$LATEST"
 
+sh build.sh
+
 docker build \
   -t azukaar/cosmos-server:$VERSION \
   -t azukaar/cosmos-server:$LATEST \

+ 9 - 32
dockerfile

@@ -6,38 +6,15 @@ EXPOSE 443 80
 
 VOLUME /config
 
-WORKDIR /app
-
-ENV PATH=$PATH:/usr/local/go/bin
-
-RUN apt-get update && apt-get install -y ca-certificates openssl && \
-    apt-get install -y --no-install-recommends  wget curl && \
-    apt-get install -y --no-install-recommends nodejs && \
-    wget https://golang.org/dl/go1.20.2.linux-amd64.tar.gz && \
-    tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz && \
-    rm go1.20.2.linux-amd64.tar.gz && \
-    curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
-    apt-get install -y nodejs && \
-    apt-get remove -y wget curl && \
-    apt-get autoremove -y
+RUN apt-get update && apt-get install -y ca-certificates openssl
 
-COPY go.mod ./
-COPY go.sum ./
-RUN go mod download
-
-COPY package.json ./
-COPY package-lock.json ./
-RUN npm install
-
-COPY . .
-RUN npm run client-build && \
-    chmod +x build.sh && \
-    ./build.sh && \
-    rm -rf /usr/local/go \
-           /tmp/* \
-           /var/lib/apt/lists/* \
-           /var/tmp/*
+WORKDIR /app
 
-WORKDIR /app/build
+COPY build/cosmos .
+COPY build/cosmos_gray.png .
+COPY build/Logo.png .
+COPY build/GeoLite2-Country.mmdb .
+COPY build/meta.json .
+COPY static ./static
 
-CMD ["./cosmos"]
+CMD ["./cosmos"]

+ 11 - 32
dockerfile.arm64

@@ -6,38 +6,17 @@ EXPOSE 443 80
 
 VOLUME /config
 
-WORKDIR /app
-
-ENV PATH=$PATH:/usr/local/go/bin
-
-RUN apt-get update && apt-get install -y ca-certificates openssl && \
-    apt-get install -y --no-install-recommends  wget curl && \
-    apt-get install -y --no-install-recommends nodejs && \
-    wget https://golang.org/dl/go1.20.2.linux-arm64.tar.gz && \
-    tar -C /usr/local -xzf go1.20.2.linux-arm64.tar.gz && \
-    rm go1.20.2.linux-arm64.tar.gz && \
-    curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
-    apt-get install -y nodejs && \
-    apt-get remove -y wget curl && \
-    apt-get autoremove -y
+RUN apt-get clean
+RUN apt-get update 
+RUN apt-get install -y ca-certificates openssl
 
-COPY go.mod ./
-COPY go.sum ./
-RUN go mod download
-
-COPY package.json ./
-COPY package-lock.json ./
-RUN npm install
-
-COPY . .
-RUN npm run client-build && \
-    chmod +x build.sh && \
-    ./build.sh && \
-    rm -rf /usr/local/go \
-           /tmp/* \
-           /var/lib/apt/lists/* \
-           /var/tmp/*
+WORKDIR /app
 
-WORKDIR /app/build
+COPY build/cosmos .
+COPY build/cosmos_gray.png .
+COPY build/Logo.png .
+COPY build/GeoLite2-Country.mmdb .
+COPY build/meta.json .
+COPY static ./static
 
-CMD ["./cosmos"]
+CMD ["./cosmos"]

+ 43 - 0
dockerfile.local

@@ -0,0 +1,43 @@
+# syntax=docker/dockerfile:1
+
+FROM debian
+
+EXPOSE 443 80
+
+VOLUME /config
+
+WORKDIR /app
+
+ENV PATH=$PATH:/usr/local/go/bin
+
+RUN apt-get update && apt-get install -y ca-certificates openssl && \
+    apt-get install -y --no-install-recommends  wget curl && \
+    apt-get install -y --no-install-recommends nodejs && \
+    wget https://golang.org/dl/go1.20.2.linux-amd64.tar.gz && \
+    tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz && \
+    rm go1.20.2.linux-amd64.tar.gz && \
+    curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
+    apt-get install -y nodejs && \
+    apt-get remove -y wget curl && \
+    apt-get autoremove -y
+
+COPY go.mod ./
+COPY go.sum ./
+RUN go mod download
+
+COPY package.json ./
+COPY package-lock.json ./
+RUN npm install
+
+COPY . .
+RUN npm run client-build && \
+    chmod +x build.sh && \
+    ./build.sh && \
+    rm -rf /usr/local/go \
+           /tmp/* \
+           /var/lib/apt/lists/* \
+           /var/tmp/*
+
+WORKDIR /app/build
+
+CMD ["./cosmos"]

+ 1 - 1
package.json

@@ -58,7 +58,7 @@
     "start": "env COSMOS_HOSTNAME=localhost CONFIG_FILE=./config_dev.json EZ=UTC build/cosmos",
     "build": "sh build.sh",
     "dev": "npm run build && npm run start",
-    "dockerdevbuild": "sh build.sh && docker build --tag cosmos-dev .",
+    "dockerdevbuild": "sh build.sh && docker build -f dockerfile.local --tag cosmos-dev .",
     "dockerdevrun": "docker stop cosmos-dev; docker rm cosmos-dev; docker run -d -p 80:80 -p 443:443 -e DOCKER_HOST=tcp://host.docker.internal:2375 -e COSMOS_MONGODB=$MONGODB -e COSMOS_LOG_LEVEL=DEBUG -v /:/mnt/host  --restart=unless-stopped -h cosmos-dev --name cosmos-dev cosmos-dev",
     "dockerdev": "npm run dockerdevbuild && npm run dockerdevrun",
     "dockerdevclient": "npm run client-build && npm run dockerdevbuild && npm run dockerdevrun",