Browse Source

Remove bluebird dependency, use alpine for docker

master
Colin Reeder 2 years ago
parent
commit
ba87035aba
4 changed files with 8 additions and 32 deletions
  1. +4
    -12
      Dockerfile
  2. +4
    -4
      index.js
  3. +0
    -11
      package-lock.json
  4. +0
    -5
      package.json

+ 4
- 12
Dockerfile View File

@@ -1,15 +1,7 @@
FROM node:carbon
FROM node:carbon-alpine
RUN apk update && apk add git && rm -rf /var/cache/apk/*
WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 2500

COPY --chown=node index.js .
USER node
EXPOSE 2500
CMD [ "node", "index.js" ]

+ 4
- 4
index.js View File

@@ -2,18 +2,18 @@ const http = require('http');
const qs = require('querystring');
const fs = require('fs');
const path = require('path');
const util = require('util');
const childProcess = require('child_process');
const bluebird = require('bluebird');

bluebird.promisifyAll(childProcess);
const execAsync = util.promisify(childProcess.exec);

const keys = fs.readFileSync("./allowed_keys.txt").toString().split("\n");

function updateMirror(repo) {
const wd = path.join(__dirname, "repos", repo + ".git");
console.log("wd:", wd);
childProcess.execAsync("git fetch origin", {cwd: wd})
.then(() => childProcess.execAsync("git push --mirror target", {cwd: wd}))
execAsync("git fetch origin", {cwd: wd})
.then(() => execAsync("git push --mirror target", {cwd: wd}))
.then(() => console.log("updated", repo),
console.error);
}


+ 0
- 11
package-lock.json View File

@@ -1,11 +0,0 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"bluebird": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
"integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
}
}
}

+ 0
- 5
package.json View File

@@ -1,5 +0,0 @@
{
"dependencies": {
"bluebird": "^3.5.1"
}
}

Loading…
Cancel
Save