Docker unable to copy .git folder - windows

When trying to generate a file called head with the current commit hash during a docker build (for internal .NET service versioning) it seems that docker is unable to pull the .git folder into the image at all.
Given the following DockerFile
FROM alpine/git AS version
WORKDIR /src
COPY .git/ ./.git/
RUN git rev-parse HEAD > head
This happens:
=> ERROR [version 2/4] COPY .git/ ./.git/ 0.0s
------
> [version 2/4] COPY .git/ ./.git/:
------
failed to compute cache key: "/.git" not found: not found
What is perhaps more interesting is that when using COPY . . it fails like so:
=> ERROR [version 4/4] RUN git rev-parse HEAD > head 1.7s
------
> [version 4/4] RUN git rev-parse HEAD > head:
#36 1.613 fatal: not a git repository (or any of the parent directories): .git
------
executor failed running [/bin/sh -c git rev-parse HEAD > head]: exit code: 128
The git folder is at the same root as the Dockerfile as ls -Force (windows powershell version of ls -a) the following result is returned (a few folders redacted for privacy):
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 11/4/2020 2:45 PM .ci
d--h-- 3/17/2021 3:06 PM .git
d----- 2/3/2021 6:12 PM .github
d----- 9/8/2020 7:22 PM .idea
d----- 1/20/2021 1:50 PM .run
d--h-- 9/29/2020 6:53 PM .vs
d----- 3/17/2021 10:55 AM build
d----- 11/4/2020 2:45 PM lib
d----- 9/7/2020 11:12 AM src
d----- 11/4/2020 2:45 PM tests
-a---- 3/15/2021 4:19 PM 340 .dockerignore
-a---- 2/3/2021 6:12 PM 186 .editorconfig
-a---- 2/3/2021 6:12 PM 580 .gitignore
-a---- 3/17/2021 4:07 PM 1611 Dockerfile
Unhiding the .git does not change this behavior.
https://stackoverflow.com/a/54150671/1890717 is a related answer that does not seem to be working here. At least on Windows 10

Check if .git is included in your .dockerignore file and if so, remove it.

Related

What is the purpose of these Visual Studio directories?

In what way are these directories used by Visual Studio?
Get-ChildItem -Path $Env:USERPROFILE\AppData\Roaming\Microsoft\VisualStudio
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2019-12-27 20:24 10.0
d----- 2019-12-27 17:28 11.0
d----- 2020-01-14 08:34 15.0
d----- 2019-12-23 11:52 15.0_52fe5057
d----- 2020-03-24 11:10 15.0_6cf8de10
d----- 2019-12-31 10:10 15.0_6cf8de10Exp
d----- 2020-06-29 16:43 15.0_cffcaa9f
They are folders containing the various preferences of parts of the different versions of Visual Studio you have installed. Looking in mine (I only have VS2019 installed) and guessing based on filenames due to binary data; it contains: the window layouts of VS, Team Explorer previously-configured connection details, Activity logs, auto-recover project backup files, UI layout, and backup User settings.

Error When Importing ROS Projects & Workspace in CLion

I wanted to give CLion a try for working with the ROS source code. I created a ROS Workspace and have the following folder structure:
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects$ cd catkin_ws/
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020  .
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:10 2020  ..
.rw-rw-r-- joesan joesan 98 B Sun Aug 30 10:48:27 2020  .catkin_workspace
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020  build
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:26 2020  devel
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 12:13:50 2020  src
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects/catkin_ws$
I have sourced this location in the .bash_profile as below:
# Dynamically source all setup.bash files from multiple catkin ros workspaces
find /home/joesan/Projects/Private/ros-projects -wholename '*/devel/setup.bash' | xargs source
I then source the .bash_profile from within my .bashrc
Now, when I tried to open the project in CLion, I see the following error:
CMake Error at CMakeLists.txt:65 (message):
find_package(catkin) failed. catkin was neither found in the workspace nor
in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was
sourced before.
I launch CLion via a Desktop shortcut entry that I created. How do I make CLion aware of this .bash_profile such that it can find catkin?
I managed to fix this by doing the following, but make sure that you have a Desktop entry created for Jetbrains CLion beforehand!
Open the jetbrains-clion.desktop located in the .local folder:
~/.local/share/applications/jetbrains-clion.desktop
In this desktop entry, modify the Exec= line as:
Exec=bash -i -c "/opt/softwares/clion-2020.2.1/bin/clion.sh" %f

M2_HOME is set to an invalid directory even when it points to maven installation home

I have set my M2_HOME to
C:\Users\username\Documents\apache-maven-3.5.0
Contents of above directory
09/21/2017 05:13 PM <DIR> .
09/21/2017 05:13 PM <DIR> ..
09/21/2017 05:13 PM <DIR> bin
09/21/2017 05:13 PM <DIR> boot
09/21/2017 05:13 PM <DIR> conf
09/21/2017 05:13 PM <DIR> lib
04/03/2017 08:41 PM 20,934 LICENSE
04/03/2017 08:40 PM 182 NOTICE
04/03/2017 08:36 PM 2,544 README.txt
3 File(s) 23,660 bytes
6 Dir(s) 348,568,027,136 bytes free
However when I run mvn --version in cmd, I get the following error
ERROR: M2_HOME is set to an invalid directory.
M2_HOME = "C:\Users\abhish\Documents\apache-maven-3.5.0"
Please set the M2_HOME variable in your environment to match the
location of the Maven installation
I checked a similar post on SO. However that didnt help, hence posting this question.
I need this solved to solve this problem.
if u are using java 8, please remove "MAVEN_OPTS" from environmental variable and check. because java 8 doesn't support for that config.

VSCode Installation Failed - Failed to extract installer

VSCodeSetup.exe
Installation has failed
Failed to extract installer
I am unable to install or open up the Setup Log.
Trying to install on Windows 8.1 Enterprise
I just downloaded VSCodeSetup.exe and the installation failed with an error dialog when I ran it on Windows 7.1 SP1.
I then right clicked on the VSCodeSetup.exe file and used 7Zip to extract the archived files to a VSCodeSetup folder, with the resulting files:
Mode LastWriteTime Length Name
---- ------------- ------ ----
----- 4/22/2015 8:28 AM 140782 background.gif
----- 4/27/2015 6:22 PM 60255967 Code-0.1.0-full.nupkg
----- 4/27/2015 6:22 PM 74 RELEASES
-a--- 4/30/2015 9:25 AM 1911 SquirrelSetup.log
----- 4/24/2015 11:12 AM 1492992 Update.exe
I then opened PowerShell (a CMD window would also work). I cd'd into the VSCodeSetup folder and ran the following command:
PS>.\Update.exe --install=.
Installation completed successfully and Visual Studio Code opened.
Hope this helps.
Rick

Why can't Visual Studio find System.Web.Mvc.resources.dll?

I keep getting these 11 errors in Visual Studio:
Error 456 Could not copy the file "_bin_deployableAssemblies\de\System.Web.Mvc.resources.dll" because it was not found. ViMuDat
Error 457 Could not copy the file "_bin_deployableAssemblies\de\WebMatrix.WebData.resources.dll" because it was not found. ViMuDat
Error 458 Could not copy the file "_bin_deployableAssemblies\de\WebMatrix.Data.resources.dll" because it was not found. ViMuDat
Error 459 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.resources.dll" because it was not found. ViMuDat
Error 460 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.Razor.resources.dll" because it was not found. ViMuDat
Error 461 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.Deployment.resources.dll" because it was not found. ViMuDat
Error 462 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.Administration.resources.dll" because it was not found. ViMuDat
Error 463 Could not copy the file "_bin_deployableAssemblies\de\System.Web.Razor.resources.dll" because it was not found. ViMuDat
Error 464 Could not copy the file "_bin_deployableAssemblies\de\System.Web.Helpers.resources.dll" because it was not found. ViMuDat
Error 465 Could not copy the file "_bin_deployableAssemblies\de\NuGet.Core.resources.dll" because it was not found. ViMuDat
Error 466 Could not copy the file "_bin_deployableAssemblies\de\Microsoft.Web.Infrastructure.resources.dll" because it was not found. ViMuDat
I try to build a project that was developed with Visual Studio 2010, but I am using Visual Studio 2012. If I build it twice, it works without errors.
How can I fix that?
I have found Bin Deploying ASP.NET MVC 3 and _bin_deployableAssemblies and MSBuild, but I could not manage to fix those errors. Could somebody please explain step by step what I should do? I am new to C# and Visual Studio.
I think this error is also the problem why I can't Check in the project into a TFS.
I have these assemblies in my bin folder:
D:\...\bin> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 18.12.2012 23:53 de
-a--- 15.12.2012 21:11 783648 EntityFramework.dll
-a--- 15.12.2012 21:11 834489 EntityFramework.xml
-a--- 18.12.2012 23:53 42496 LumenWorks.Framework.IO.dll
-a--- 18.12.2012 23:53 116224 LumenWorks.Framework.IO.pdb
-a--- 18.03.2010 18:31 53640 System.ComponentModel.DataAnnotati
ons.dll
-a--- 18.03.2010 18:31 1328984 System.Data.dll
-a--- 18.03.2010 18:31 919880 System.dll
-a--- 18.03.2010 18:31 24944 System.Web.Abstractions.dll
-a--- 18.03.2010 18:31 2824528 System.Web.dll
-a--- 05.01.2011 14:45 130408 System.Web.Helpers.dll
-a--- 03.05.2012 08:55 37861 System.Web.Helpers.xml
-a--- 05.01.2011 16:42 445280 System.Web.Mvc.dll
-a--- 03.05.2012 08:51 777665 System.Web.Mvc.xml
-a--- 18.03.2010 18:31 24928 System.Web.Routing.dll
-a--- 05.01.2011 14:45 136552 System.Web.WebPages.dll
-a--- 03.05.2012 08:55 51735 System.Web.WebPages.xml
-a--- 18.03.2010 18:31 941904 System.Xml.dll
-a--- 18.12.2012 23:53 244736 ViMuDat.dll
-a--- 18.12.2012 23:53 321024 ViMuDat.pdb
-a--- 18.12.2012 23:53 125308 ViMuDat.XML
D:\...\bin\de> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 12.01.2011 16:04 15720 System.Web.Helpers.resources.dll
-a--- 12.01.2011 17:24 32096 System.Web.Mvc.resources.dll
-a--- 12.01.2011 16:04 15208 System.Web.WebPages.resources.dll
If you are bin deploying MVC 3, there are some assemblies that you have to package up in your deployment. Scott Hanselman has a good write up on what and where as well.
If you have copied the assemblies, make user to add then as 'content' to your Visual Studio project. Then they will be automatically copied into the correct structure in the bin directory when you build.
EDIT:
This was the information in the article that helped solve the problem:
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies and
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies contained the missing dlls
Those dlls had to be copied manually to _bin_deployableAssemblies of my project.
You might find it easier to just install the packages via nuget.
NuGet is a package manager which makes it easy to install and update dependencies in your project. It is a Visual Studio extension which can be installed from here.
If you are still using ASP.NET MVC3, you can install an older version of the package by using the command Install-Package Microsoft.AspNet.Mvc -Version 3.0.20105.1.
This will add the binaries as normal references which are included in the bin folder when your project is built. This will save you having to do the _bin_deployableAssemblies approach. Most other popular 3rd party frameworks (as well as a lot of the new Microsoft Web stack) are also available on nuget.

Resources