I'm trying to dockerize a Proton-Native App, buy i'am not able of see the basic proyect
This is my Dockerfile
FROM node:13
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
RUN npm install
COPY . ./
RUN npx proton-native-cli init .
CMD ["npm", "start"]
Then I run
docker build -t sample:dev .
and
docker run sample:dev
Assuming that is posible see the GUI, not only access the docker image. What would be the correct way to complete the configuration?
Thanks for read! :)
This idea, dockerizing a Proton-Native App for see the gui, is not a simple task, requires "a lot of extra work to get the display to show up at all (including installing extra host software on non-Linux hosts) and even more work to get access to user preferences and data files", like #DavidMaze explains
Related
Background:
Dear Stackoverflow community. I recently switched from Windows to MacOS and am at a loss how to configure environment variables. Many of the previous questions asked here are about bash instead of zsh.
Goal:
I am trying to install an npm package globally. For instance:
npm install -g vercel
or any other package, and use it in my Visual Studio Code terminal (also zsh). If I want to deploy code I have to use 'npx vercel deploy' every time. I want to be able to use "vercel deploy" but instead I get:
zsh: command not found: vercel
What I tried so far:
Installing the package in zsh and visual studio code terminals (didn't work)
Setting the path equal on both VS and terminal: export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I learned that you need to add environment variabels to a .zshrc file. I don't seem to have a zshrc file. When I do:
sudo ~/.zshrc
Password: XXXXXX
sudo: /Users/vincent/.zshrc: command not found
I am getting another error.
I read in the zsh man file that you should use $HOME/.zshrc instead. Again I am getting the same errors:
vincent#Vincents-MacBook-Air-2 ~ % $HOME/.zshrc
zsh: permission denied: /Users/vincent/.zshrc
vincent#Vincents-MacBook-Air-2 ~ % sudo $HOME/.zshrc
sudo: /Users/vincent/.zshrc: command not found
Update 1:
#slebetman Thank you for your explanation. When I open the terminal I go to home via "cd $HOME" which puts me in in the home directory. However there is no way for me to create a .zshrc file in that directory. Neither via touch or vs code. I am getting the following error: "Unable to write file '/home/.zshrc' (Unknown (FileSystemError): Error: ENOTSUP: operation not supported on socket, open '/home/.zshrc')"
Update 2:
I did manage to find the .zshrc file in visual studio code under /etc. I hope this will work. I was able to overwrite the file with Sudo and add environment variables to it.
Add this to the file .zshrc file under /etc and force overwrite it:
export vercel=/Users/vincent/.npm-global/bin/vercel
Screenshots below for those who will try in the future:
Image with .zshrc file layout
Final remarks:
I don't understand how it is so difficult to add environment variables on Mac while everything else is so easy.
I have read many different questions on stackoverflow, and I can't seem to solve it. Also since I am a newbie I am not allowed to comment on there so I post here in the hope that anyone can help me :)
Best,
Vincent
Note that when you do:
npx vercel deploy
Npm will execute vercel for you without installing it. It does that by temporarily downloading vercel. If you want to run vercel directly without using npx then simply don't use npx. Install it instead:
npm install -g vercel
The -g flag installs the module globally and if the module has a CLI it will be available globally as well (note that depending on your setup you may need admin/sudo privileges to use the -g flag). Now you can run vercel by simply typing:
vercel deploy
This works in all operating systems supported by node.js and npm. That means you can even do this in Windows. In fact I use npm to distribute my tools in a simple cross-platform way so I don't have to support multiple package managers like chocolatey (Windows), homebrew (Mac OS), deb (Debian based distros), rpm (Redhat based distros) etc. (npm does not require your software to be written in node.js - I have published packages on npm written in tcl and bash).
I have a small react native app, and I'm trying to run it using docker. I believe I know what my problem is, but I really can't solve it. My Dockerfile is as such:
FROM node:12
WORKDIR /client
COPY package*.json ./
RUN yarn install
RUN yarn global add expo-cli
COPY . .
ENV PORT=8080
EXPOSE 8080
CMD ["yarn", "start"]
I built my image, and then tried to run it using: docker run -p 19002:8080 53abf08beb39. Everything looks ok, expo tells me it is running in localhost:19002, and that the app is running in localhost:19000. Despite this, when i try to access these ports, I only see a "this site can't be reached" page. I was told this was because expo is exposing the port, but since it's running in docker, it can only be accessed from inside the container, so I need a way to expose this out of the container to be able to run it on my laptop. How can I achieve this?
Also, if anyone knows how should I create a docker-compose file to run all this, it would be great.
My VPS server is all set. Node is installed, I built an app and ran it with
npm install -g serve
serve -s dist
as it was mentioned in the docs.
But after I close my console the application is not available anymore. I'm aware about PM2, but I couldnt run
serve -s dist
with it.
I would appreciate the ideas on easy way to always serve the application on server
Thanx
After struggling quite a while with nginx i finally managed to set it up properly. So as far as I understand, the only solution is to install a web-server, such as Nginx
I am using Node 6.10.1 and npm 3.10.10 on a Dell XPS 15 running Ubuntu 16.04 with Kernel 4.13.0.0-36-generic.
I am behind a corporate proxy which is configured through cntlm.
When I run an npm install -d on a project It works from a short time, and after a while I get Error: socket hang up.
I have found numerous questions about my problem but no solution seemed to work.
Here is an extract of a npm config list :
; cli configs
user-agent = "npm/3.10.10 node/v6.10.1 linux x64"
; userconfig /home/msb/.npmrc
https-proxy = "http://localhost:3128/"
registry = "http://urlTocorporateRegistryWhichWorksOnOtherComputers"
strict-ssl = false
; node bin location = /home/msb/.nvm/versions/node/v6.10.1/bin/node
; cwd = /home/msb
; HOME = /home/msb
; "npm config ls -l" to show all defaults.
I cannot change the registry since we are using some internal modules, and I have to keep the current versions of node/npm.
I have already tried :
Using the proxy directly in npm config rather than through cntlm
Limiting my upload/download capabilities with trickle through the command trickle -s -d 100 -u 100 npm install -d
Another indication : It works on Windows, and I have a collegue running Ubuntu 17.04 on a slower pc and it works for him. We think my machine might be a bit too brutal when requesting the registry. Does anyone know a way to slow npm requests ?
It used to work through yarn but some new developments have forced me to go back to npm.
Has anyone encountered and corrected this problem ?
Thanks for your help.
I experimented the same problem, with no apparent reason, on Ubuntu 18.04.
I finally used docker with bind mounts to solve it. The steps are the following:
Create a dockerfile with the following elements (you can also directly run with the used image if you don't need to configure a proxy like me)
FROM node:6.10.1
ENV HTTPS_PROXY "http://yourproxy:yourport/"
# Different RUN commands to configure npm and git corporate proxy
WORKDIR /home/root/
Build the image (from the dockerfile's folder): docker image build -f npm-installer/Dockerfile -t custom-npm-installer .
Go inside the project folder where you would normally run npm install
Run the following command to run the container interactively: docker container run -it --network host -v </host/path/to/pj>:/home/root/pj-to-install --name custom-npm-installer custom-npm-installer bash
You can now run the npm install command from the container. Careful however, you'll then need to use chmod on the node_modules folder recursively since the container uses root by default.
Another thing, if you're using node-sass, it is most of the time compiled on the fly when npm installing, and matches your OS current version/architecture. So if your linux distribution is not exactly the same than the container's you might need to recompile node-sass on your host after running npm install on the container. No worries though, node-sass will give you the command to run the moment you launch your application.
I want to "build" my npm build and create a docker image with it. That means I need a docker image that is able to a) run npm and b) run docker.
Currently I struggle in finding / creating such a docker image. How can I solve my problem?
Thanks!
Edit:
I managed to have a combined container, but my build is not able to find a running docker instance:
Post http:///var/run/docker.sock/v1.20/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=registry.gitlab.com%2Ftss-repocar%2Fapp&ulimits=null: dial unix /var/run/docker.sock: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?
Post http:///var/run/docker.sock/v1.20/images/registry.gitlab.com/tss-repocar/app/push?tag=: dial unix /var/run/docker.sock: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?
Use Packer. You run commands in Packer to do all of your NPM setup, and it will spit out a Docker container.
Here is packer
https://www.packer.io/docs/
And then I found this
https://www.npmjs.com/package/node-packer
To build docker images your build container must have access to /var/run/docker.sock (or you have to use Docker in Docker).
Assuming you have your gitlab-ci-multi-runner in a Docker Container itself, change /etc/gitlab-runner/config.toml to look like this:
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]