Cannot copy long path files in Windows 10 within Dockerfile COPY - windows

I build an image from a base image. In the Dockerfile of the base image I run a command ONBUILD COPY . /workspace. When I build my image from this base image then it copy all the files from current directory to the /workspace directory of the result image.
Then I run mvn clean install from the Dockerfile with an error: cannot find symbol. The problem is that all the .java files that has long path names are not copied from current directory to the /workspace directory and so the error.
I tried to activate long pathns in Local Computer Policy, I also checked it in the registry, but it does't helped. I tried to run CMD as Administrator and then also tried to build from Git Bash command line, none fixed the problem.
Does anyone knows what could be the problem and how to resolve it?

Related

Run `flutter clean` command on each project in a directory

As a Flutter developer, I've been working on many projects. I have to work on all of them occasionally. Now those projects lie in a single directory occupying 30+ GB on my drive. It'd be a good idea to have the project's build-cache deleted to save some space. So I figured to write a script that would loop through each of them and run flutter clean inside every folder instead of running the command manually under each project's root.
After Google and StackOverflow search I came up with a command :
for /D %G in ("D:\MyProjects\*") do flutter clean "%~fG"
Well this command executes the flutter clean command for each folder like:
C:\Users\vipin>flutter clean "D:\MyProjects\Project1"
C:\Users\vipin>flutter clean "D:\MyProjects\Project2"
C:\Users\vipin>flutter clean "D:\MyProjects\Project3"
C:\Users\vipin>flutter clean "D:\MyProjects\Project4"
This should have worked since the command states to run flutter clean for each folder as it looked. Unfortunately, it didn't and threw error:
C:\Users\vipin>flutter clean "D:\MyProjects\Project1"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
C:\Users\vipin>flutter clean "D:\MyProjects\Project2"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
C:\Users\vipin>flutter clean "D:\MyProjects\Project3"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
C:\Users\vipin>flutter clean "D:\MyProjects\Project4"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
...
Well, the pubspec.yaml files are very much present in each folder and I figured that the flutter clean command demands your prompt pointing to Project's ROOT, like below to do the job:
D:\Myprojects\Project1>flutter clean
Now I'm looking for a command/script anything to move the command's prompt to each project's root and execute the command.
Glad you asked. I had the same thought about doing it to my list of projects. The below command will do exactly what you expect. Make sure to run this from D:\MyProjects
for /d %i in (D:\MyProjects\*) do ( cd "%i" & flutter clean )

yocto project runqemu: command not found

I am setting up my yocto project, for that i have followed these below steps:
download the Poky Source code (ubuntu: /yocto/source)
$ git clone git://git.yoctoproject.org/poky
Checkout the latest branch/release (zeus)
$ git checkout zeus
Step 3: Prepare the build environment (ubuntu: /yocto/source/poky)
$ source oe-init-build-env ../../build
The above script will move in a build folder and create two files in conf folder ( local.conf, bblayers.conf ) inside conf folder
Building Linux Distribution (unbuntu: /yoctu/build)
$ bitbake core-image-minimal
Checking the runqemu (ubuntu: /yocto/source/poky/scripts)
$ ls runqemu // and it is there
Run generated image in qemu (ubuntu: /yocto/build)
$ runqemu qemux86-64 core-image-minimal
other window open for qemu and image runs well.
Problem
After using first time when i close the terminal, and use it again by running $ runqemu qemux86-64 core-image-minimal in (ubuntu: /yocto/build) error pops up runqemu: command not found and if i write bitbake in poky directory same error pops up bitbake: command not found.
NOTE: i have repeat this whole process 3 times to check if the installation is not correct but i have done everything fine from my side.
yocto project hierarchy:
If you close your poky environment terminal you always MUST re-source the environment.
The poky's oe-init-build-env setups up all commands for you, for instance:
runqemu* commands which are present in poky/scripts.
The script also export bitbake* commands from poky/bitbake/bin.
The line responsible for that is in:
poky/scripts/oe-buildenv-internal (line 99):
# Make sure our paths are at the beginning of $PATH
for newpath in "$BITBAKEDIR/bin" "$OEROOT/scripts"; do
# Remove any existences of $newpath from $PATH
PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##")
# Add $newpath to $PATH
PATH="$newpath:$PATH"
done
So, always if you open new terminal:
source /yocto/source/poky/oe-init-build-env /yoctu/build
EDIT
If you already have a build folder, make sure to provide the right path for that folder to the oe-init-build-env script.
If you provide new path to non-existing folder, than the script will create another build for you.
EDIT2
To source poky environment according to your path:
Relative:
cd ~/Documents/yocto/source/poky
source oe-init-build-env build
^
|
(because build is in same folder as the script)
Absolute:
source /home/$USER/Documents/yocto/source/poky/oe-init-build-env /home/$USER/Documents/yocto/source/poky/build
THE RULE
source <path/to/oe-init-build-env> <path/to/build/folder>
If <path/to/build/folder> exists then, poky will source the existing build environment.
If <path/to/build/folder> does not exist, poky will create new build under the same name and path.

Not able to build ROS package with catkin_make. Confused by package tree

I'm looking to run the main.launch stored in vehicle/launch/ from this github page
https://github.com/aureliopuebla/vehicle
I am very new at using ROS and have been learning, however I can't seem to be able to build these files.
If I try to use catkin_make on the parent folder it says that there is no existing 'src' folder.
If I go into the /vehicle folder there is a 'src' folder, but if I try to run catkin_make there, then it says that I have to run it at the root of the workspace. Which has me a bit stumped.
I have also tried to just run 'cmake ..', then 'make', and then 'sudo make install' in the /vehicle folder, but that just fills the /vehicle folder with copies of the other folders in the parent folder.
The reason why I want to build these packages is to be able to run the 'main.launch' file inside the '/vehicle/launch' folder with roslaunch, but it keeps saying that it can't find the other packages, no matter what I do.
Ready to clear up any questions. Thanks for the help.
the CMakeLists.txt in the folder is the top-level CMakeLists. So You need to make this src folder yourself.
Just do the following:
$ mkdir -p vehicle_ws && cd vehicle_ws
$ git clone https://github.com/aureliopuebla/vehicle.git
$ mv vehicle src
$ catkin_make
This way it should work. Just leave out mkdir -p vehicle_ws, if you already created a workspace and instead just cd into it.

Docker file, symlink disappears mid build

I have the following docker file (at the bottom). I am using another image to grab a precompiled library (utilities) and copying it into the route of a new image. I then need to symlink that directory into my node_modules directory. This works fine, I have 3 places where I prove the issue.
Check for the existence of the original root directory /utilities. This works, I can see the files
Then I create the symlink: ln -sf ...
I think check to see the contents at the location of the symlink. This works, I can see the files.
I go on to create the rest of the image
At the end I again list out the files, and now I get
ls: /usr/src/app/node_modules/#boiler/utilities: No such file or directory
It's like the symlink doesn't persist. If I run the container with shell: docker run -it --entrypoint=sh backend:latest and create the symlink it works.
Any thoughts as to where my symlink is going?
FROM utilities-setup:latest as build
FROM node:8.5.0-alpine
COPY --from=build /utilities /utilities
RUN ls -l /utilities <-- 1. THIS WORKS, FILES EXIST
#setup directories
RUN mkdir -p /usr/src/app/node_modules/#boiler/
WORKDIR /usr/src/app
#create symlink to the utilities module into the boiler module
RUN ln -sf /utilities /usr/src/app/node_modules/#boiler/
RUN ls /usr/src/app/node_modules/#boiler/utilities <-- 2. THIS WORKS, FILES EXIST
#copy the content of the backend to the current direcotry
COPY . .
RUN yarn install
RUN ls /usr/src/app/node_modules/#boiler/utilities <-- 3. THIS FAILS, NO MODULE
RUN ["chmod", "+x", "./scripts/prod.sh"]
EXPOSE 8080
ENTRYPOINT ["/usr/src/app/scripts/prod.sh"]
[see comment] I clocked the problem.
What was happening was the yarn install was recreating the node_modules directory, so you have to create the symlink after all other modules are installed. Makes sense I suppose, but I thought it would just write to the directory if it already existed

Building small container for running compiled go code

From
https://docs.docker.com/articles/baseimages/
I am trying to build a base image to run compiled go code, from:
https://github.com/tianon/dockerfiles/tree/master/true
I have tried to copy into docker the true.goThen: exec: "/true": permission denied
Also tried to bash into it, then: "bash"Then: executable file not found in $PATH
Also tried to use the debootstrap raring raring > /dev/null Then: "bash": executable file not found in $PATH
How do you do this?
Thanks
I'm not sure I entirely follow.
The Dockerfile from the linked project builds an image with nothing in it except an executable - there will be no shell or compiler, so running bash will be impossible. It does this by using the special scratch base image, which is simply a completely empty filesystem.
If you clone the repository and build the image using the Dockerfile (docker build -t go-image .), it will simply copy the executable directly into the image (note the Dockerfile copies the executable true-asm, not the source code true.go). If you then use docker run to start the image, it will run it (docker run go-image).
Does that make sense? The code is compiled locally (or by another container) and the compiled, stand-alone executable is placed by itself into the image.
Generally, you don't want to do this and definitely not when you're beginning - it will be easier for you to use a golang or debian image which will include basic tools such as a shell.

Resources