electron-release-server icon indicating copy to clipboard operation
electron-release-server copied to clipboard

Troubles building the Docker image

Open Lenormju opened this issue 1 year ago • 0 comments

Hello,

I had to build the Dockerfile (see #330) and hit several problems :

  • I had to build on a network that reaches internet through a corporate proxy
  • I got Bower errors (unsure why, and I'm not an expert in it)
  • It was not using an Alpine image (personal preference)

Here are the modifications I made :

Dockerfile

-FROM node:19
+FROM node:19-alpine
 
 # Create app directory
 WORKDIR /usr/src/electron-release-server
 
+RUN mkdir -p /usr/local/share/ca-certificates/
 # Create app directory
 WORKDIR /usr/src/electron-release-server
 
+RUN mkdir -p /usr/local/share/ca-certificates/
+RUN wget -Y off -O /root/my-root-ca.crt URL_TO_THE_FILE_CA.crt
+RUN cat /root/my-root-ca.crt >> /etc/ssl/certs/ca-certificates.crt
+RUN cat /root/my-root-ca.crt >> /usr/local/share/ca-certificates/ca-certificates.crt
+RUN apk --update add ca-certificates
+RUN update-ca-certificates
+
+RUN apk --update add git
+
 # Install app dependencies
-COPY package.json .bowerrc bower.json /usr/src/electron-release-server/
+COPY package.json package-lock.json .bowerrc bower.json /usr/src/electron-release-server/
 RUN npm install \

(replace URL_TO_THE_FILE_CA by yours)

.bowerrc

 {
-  "directory": "assets/bower_components"
+  "directory": "assets/bower_components",
+  "proxy": "http://PROXY_URL:80",
+  "https-proxy": "http://PROXY_URL:80",
+  "ca": "/usr/local/share/ca-certificates/ca-certificates.crt"
 }

(replace PROXY_URL by yours)

package.json

     "inspect": "node --inspect app.js",
     "start": "node app.js",
     "migrate": "db-migrate",
-    "postinstall": "bower install",
     "eslint": "eslint ./*.js api assets/js config migrations tasks",
     "stylelint": "stylelint assets/styles/*.*"
   },

Lenormju avatar Nov 30 '23 07:11 Lenormju