Why is docker build prefixing my copy path with a temp directory? - asp.net

Here is the DockerFile.
FROM microsoft/aspnet:4.7
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
And here is the error.
Error
Building a.enterpriseextservices
Service 'a.enterpriseextservices' failed to build: COPY failed:
GetFileAttributesEx \\?\C:\Users\jesmiller-AM\AppData\Local\Temp\docker-
builder587295999\obj\Docker\publish: The system cannot find the file specified..
For more troubleshooting information, go to
http://aka.ms/DockerToolsTroubleshooting docker-compose C:\Program Files
(x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 349
I have published the project to the obj/Docker/publish folder.
Here is my docker-compose file. I used the docker-compose up command from the folder where the docker-compose.yml file is located.
version: '3'
services:
a.web.familyconnection:
image: a.web.familyconnection
build:
context: .\FamilyConnection
dockerfile: Dockerfile
b.enterpriseextservices:
image: b.enterpriseextservices
build:
context: .\Framework\b.EnterpriseExtServices
dockerfile: Dockerfile

I had the same issue. Turned out I made a silly mistake. I added the following to my .dockerignore file, just out of habit when setting up a new project:
bin
obj
.vs
.git
Then I tried running this in my Dockerfile
COPY ./bin/publish/ .
Docker gave the strange tmp path error, because it was falling back to that path since I told it to ignore my /bin folder. Once I copied to a different publish path (not bin), the problem went away.

It looks like your path to the folders, or where you've published your code at may be incorrect. The project should be published in the obj/Docker/publish folder inside of the respective folders defined by context
Using an example docker-compose.yml:
version: "3"
services:
foo:
build: ./foo
bar:
build: ./bar
And Dockerfile:
FROM jaydorsey/ruby-2.4.1
COPY ${source:-obj/Docker/publish} .
And a tree structure like this:
.
├── Dockerfile
├── bar
│   └── Dockerfile
├── docker-compose.yml
├── foo
│   └── Dockerfile
└── obj
└── Docker
└── publish
When I run docker-compose build I get the following error
Building foo
Step 1/2 : FROM jaydorsey/ruby-2.4.1
---> b79899b232f6
Step 2/2 : COPY ${source:-obj/Docker/publish} .
ERROR: Service 'foo' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder186649811/obj/Docker/publish: no such file or directory
This isn't identical to yours, since I'm running macOS, but very similar. You'll note the temporary file location (which is an internal Docker artifact of how it's copying files around) and the similarity in the docker-build<randomstring> path
However, if I create the obj/Docker/publish folders underneath each respective subfolder (context), the docker-compose build command works fine.
.
├── Dockerfile
├── bar
│   ├── Dockerfile
│   └── obj
│   └── Docker
│   └── publish
├── docker-compose.yml
├── foo
│   ├── Dockerfile
│   └── obj
│   └── Docker
│   └── publish
└── obj
└── Docker
└── publish
Please check that the folder you've published exists under the contexts as noted, and not in the root.
I still believe this is a path issue as noted in the error message. I hope this provides some context that helps you debug the root cause.
Can you please confirm your file & folder layout? I'm fairly certain it's path related because of the error message. I haven't done any Docker for Windows work either but I'd also double-check your default path using the correct slash (forward vs backward)

Related

Poetry script: No file/folder found

I am currently building a backend using FastAPI and I am facing some issues to run the backend using poetry scripts. This is my project structure:
├── backend
└── src
└── asgi.py
└── Dockerfile
└── poetry.lock
└── pyproject.toml
pyproject.toml
[tool.poetry]
name = "backend"
version = "0.1.0"
description = ""
authors = ["Pierre-Alexandre35 <46579114+pamousset75#users.noreply.github.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.9"
uvicorn = "^0.17.6"
fastapi = "^0.78.0"
psycopg2 = "^2.9.3"
jwt = "^1.3.1"
python-multipart = "^0.0.5"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
foo='asgi:__main__'
If I am running poetry run python asgi.py, it is working perfectly but if I am using poetry foo script, I am getting No file/folder found for package backend. Those are all combinaisons I tried and I have the same error for every poetry run foo:
foo='asgi:main'
foo='backend.asgi:__main__'
foo='backend.asgi:main'
foo='backend.asgi:.'
Your project structure does not seem to be correct. Assuming backend is the package u are trying to create.
Use this structure
└── pyproject.toml
└── poetry.lock
└── README.md
├── backend
└── src
└── asgi.py
└── Dockerfile
└── __init__.py
Also in scripts use. (Assuming you are trying to run main with foo)
[tool.poetry.scripts]
foo='backend.asgi:__main__'

“Controller does not exist. Reflection failed.” TYPO3 v2

I have a typo3 extension (created with extension manager) and it seems no matter what I try I always get the following error:
Class CM\Parser\Controller\ParserController does not exist. Reflection failed.
I used the explanations for this problem TYPO3 tutorial extension, controller does not exist and "Controller does not exist. Reflection failed." TYPO3. Neither of them seem to work.
My composer.json in the root directory has the following entry:
"autoload": {
"psr-4": {
"CM\\parser\\": "./packages/cm-parser/Classes"
}
}
My typo3conf/ext folder has a symlink on packages/cm-parser. My composer.json inside the extension directory (packages/cm-parser) has the entry:
"autoload": {
"psr-4": {
"CM\\parser\\": "./Classes"
}
}
Thanks in advance for any help.
My directory structure looks like this (starting in /opt/lampp/htdocs/my-new-project) which is a typo3 v9.5 installation
> .
├── packages
│   └── cm-parser
│   ├── Classes
│   ├── Configuration
│   ├── Documentation.tmpl
│   ├── Resources
│   └── Tests
├── public
│   ├── fileadmin
│   │   ├── _processed_
│   │   ├── _temp_
│   │   └── user_upload
│   ├── typo3
│   │   └── sysext
│   ├── typo3conf
│   │   ├── ext
│   │   └── l10n
│   ├── typo3temp
│   │   ├── assets
│   │   └── var
│   └── uploads
│   └── tx_extensionbuilder
├── var
...
In my typo3conf/ext directory there is a symlink called parser to packages/cm-parser (I think the composer created that for me).
So I hope this symlink works for Typo3.
The files ext_emconf.php and ext_localconf.php are also in the right place. The folder structure above only displays my folders (tree -L 3) up to the third level.
The controller class is CM\Parser\Controller\ParserController, while in your composer.json you're using CM\\parser\\ (with a lowercase p) in the PSR4 autoload. This should be CM\\Parser\\
After changing this you need to of course run composer dumpautoload to reload the autoload information.
In your root composer.json file:
➊ You do not need the PSR-4 autoload section for "CM\\parser\\".
➋ You possibly have to add the path to packages/* as a repository.
➌ You have to include the composer namespace of your extension.
In your file system:
➍ You do not need typo3conf/ext/ as a symbolic link to packages/.
Try the following changes:
In your root composer.json file, remove the PSR-4 autoload section as outlined above. Add the packages/ directory as a path under repositories. For example:
{
"repositories": [
{
"type": "composer",
"url": "https://composer.typo3.org/"
},
{
"type": "path",
"url": "packages/*"
}
],
...
}
Store your extension code in the following path: packages/parser/.
Assuming your extension key reads parser and your vendor name is CM, the composer namespace becomes cm/parser. Add this as a requirement to the composer config file. You can use the following command on the command line:
composer require cm/parser:dev-master
This assumes, that packages/parser/ is a valid Git repository and has the master branch (do not use a version in the extension's composer.json file).
If the local Git repository and version (in the example above: dev-master) can be found, composer will automatically install all dependencies as required and it will create a symbolic link:
typo3conf/ext/parser -> ../../../packages/parser/
Also double check if all PHP files show the correct PHP namespace: CM\Parser\... and your controller class name reads ParserController.
If you can share your TYPO3 extension code, upload it to GitHub (or any other place) and share the link here. This way people can review your code and possibly spot further errors.

Symfony 3.4 deployer fails due to permission denied of shared folder

I have developed a webapp based on Symfony3.4. On production it is deployed on a Ubuntu 18.04 Server via deployer (deployer.org).
Everything runs fine so far. The webapp is deployed in /opt/app/prod done by a user that is part of group www-data.
My webapp allows the upload of files. To support this I have added the folder data which stores the uploaded files.
In order to sustain access to the files after another release I have added the data folder to the list of shared folders.
My deploy.php looks as follows:
set('bin_dir', 'bin');
// Symfony console bin
set('bin/console', function () {
return sprintf('{{release_path}}/%s/console', trim(get('bin_dir'), '/'));
});
// Project name
set('application', 'appname');
set('http_user', 'www-data');
set('writable_mode', 'acl');
// Project repository
set('repository', '<MY_GITREPO>');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
add('shared_files', []);
add('shared_dirs', ['data']);
// Writable dirs by web server
add('writable_dirs', ['{{release_path}}','data']);
// Hosts
host('prod')
->hostname('<MY_HOST>')
->user('<MY_USER>')
->stage('prod')
->set('deploy_path', '/opt/app/prod/<MY_APPNAME>');
This leads to the following folder structure:
.
├── current -> releases/5
├── releases
│   ├── 2
│   ├── 3
│   ├── 4
│   └── 5
└── shared
├── app
└── data
So everything fine so far - with one exception:
Deployer wants to setfacl the data folder which is not allowed as the files in data belongs to www-data:www-data where deployer tries to change this as .
The command "export SYMFONY_ENV='prod'; cd /opt/app/prod/<MY_APPNAME>/releases/5 && (setfacl -RL -m u:"www-data":rwX -m u:`whoami`:rwX /opt/app/prod/<MY_APPNAME>/releases/5)" failed.
setfacl: /opt/app/prod/<MY_APPNAME>/releases/5/data/child/679/ba7f9641061879554e5cafbd6a3a557b.jpeg: Operation not permitted
I have the impression that I did a mistake in my deployer.php or I missed something.
Has someone an idea what I need to do in order to get my deployment running?
Thanks and best regards

Clion won't index auto-generated ui header files

I was having a look at the KeepassXC's source code, with Clion as my IDE of choice. After a bit of digging and navigating through the source code, I noticed that one of the source file has the following #include directive:
#include "ui_MainWindow.h"
with a red underline. Hovering over it with my mouse, it says "'ui_MainWindow.h' not found".
The project's CMakeLists.txt file provides three build types:
Debug
Release
Release With Debug Info
and, once all three build types are successfully built, the file CLion should look for is in the following location:
cmake-build-(debug|release|relwithdebuginfo)
└── src
└── keepassx_core_autogen
└── include
├── moc_KMessageWidget.cpp
├── ui_AboutDialog.h
├── ui_CategoryListWidget.h
├── ui_ChangeMasterKeyWidget.h
├── ui_CloneDialog.h
├── ui_CsvImportWidget.h
├── ui_DatabaseOpenWidget.h
├── ui_DatabaseSettingsWidgetEncryption.h
├── ui_DatabaseSettingsWidgetGeneral.h
├── ui_DatabaseSettingsWidget.h
├── ui_DetailsWidget.h
├── ui_EditEntryWidgetAdvanced.h
├── ui_EditEntryWidgetAutoType.h
├── ui_EditEntryWidgetHistory.h
├── ui_EditEntryWidgetMain.h
├── ui_EditEntryWidgetSSHAgent.h
├── ui_EditGroupWidgetMain.h
├── ui_EditWidget.h
├── ui_EditWidgetIcons.h
├── ui_EditWidgetProperties.h
├── ui_EntryAttachmentsWidget.h
├── ui_MainWindow.h
├── ui_PasswordGeneratorWidget.h
├── ui_SearchWidget.h
├── ui_SettingsWidgetGeneral.h
├── ui_SettingsWidgetSecurity.h
├── ui_SetupTotpDialog.h
├── ui_TotpDialog.h
└── ui_WelcomeWidget.h
After a couple hours trying to make it work, I've noticed something weird. The red underline will go away (and the code navigation will work too) only if I build the project in Debug mode (i.e. it'll only pick the file from the cmake-build-debug).
If I clean the debug build and use the release build, there's no way I can get CLion to pick the file from cmake-build-release. Same applies for cmake-build-relwithdebinfo.
The code compiles and runs just fine, meaning that the CMake configuration is correct.
You can solve this problem by changing Clion environment under Build, Execution, Deployment > Toolchains to use compilers installed with Qt instead.
For MinGW 64bit you'll find it under C:\Qt\Qt5.x.x\Tools\mingwxxx_64.
this answer https://stackoverflow.com/a/31293158/192798 helped me find the solution for my case. i also had the same issue for you where it used to work and then suddenly couldn't find the header file. for me, i used target_include_directories so i had to tell clion to choose the configuration corresponding to the target. (i was choosing one of the target's dependents.) then i build, then i can switch to any configuration.
for your case, after switching the configuration, you may need to build to get clion to pick up the file.
Just manually reload cmake project after build.
It works fine for me.
Reference: https://youtrack.jetbrains.com/issue/CPP-22534

Grunt assemble module not found

I'm just trying to run a quick example with assemble. I've followed the instructions and run the installer, output is here
npm install assemble --save-dev
npm WARN package.json ocscommerce-frontend#0.1.0 No description
npm WARN package.json ocscommerce-frontend#0.1.0 No repository field.
npm WARN package.json ocscommerce-frontend#0.1.0 No README data
npm WARN package.json ocscommerce-frontend#0.1.0 No license field.
npm WARN engine get-stdin#5.0.1: wanted: {"node":">=0.12.0"} (current: {"node":"0.10.32","npm":"2.14.2"})
|
> fsevents#1.0.6 install /Users/Documents/Projects/OCSCommerce/prototype/web/themes/default/build/node_modules/assemble/node_modules/assemble-core/node_modules/base-tasks/node_modules/composer/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/Documents/Projects/OCSCommerce/prototype/web/themes/default/build/node_modules/assemble/node_modules/assemble-core/node_modules/base-tasks/node_modules/composer/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v11-darwin-x64/fse.node" is installed via remote
assemble#0.7.0 node_modules/assemble
├── success-symbol#0.1.0
├── try-open#0.1.0
├── time-stamp#0.1.3
├── word-wrap#1.1.0
├── lazy-cache#1.0.3
├── base-cli#0.4.0
├── minimist#1.2.0
├── isobject#2.0.0 (isarray#0.0.1)
├── opn#3.0.3 (object-assign#4.0.1)
├── common-middleware#0.2.2 (mixin-deep#1.1.3)
├── engine-handlebars#0.8.0 (engine-utils#0.1.1, extend-shallow#2.0.1)
├── export-files#2.1.0 (lazy-cache#0.1.0)
├── ansi-colors#0.1.0 (lazy-cache#0.2.7, ansi-gray#0.1.1, ansi-yellow#0.1.1, ansi-magenta#0.1.1, ansi-bgwhite#0.1.1, ansi-bgyellow#0.1.1, ansi-blue#0.1.1, ansi-bold#0.1.1, ansi-cyan#0.1.1, ansi-bggreen#0.1.1, ansi-bgred#0.1.1, ansi-underline#0.1.1, ansi-grey#0.1.1, ansi-green#0.1.1, ansi-hidden#0.1.1, ansi-bgmagenta#0.1.1, ansi-italic#0.1.1, ansi-red#0.1.1, ansi-reset#0.1.1, ansi-black#0.1.1, ansi-dim#0.1.1, ansi-bgcyan#0.1.1, ansi-bgblue#0.1.1, ansi-white#0.1.1, ansi-inverse#0.1.1, ansi-bgblack#0.1.1, ansi-strikethrough#0.1.1)
├── composer-runtimes#0.7.0 (extend-shallow#2.0.1, ansi-gray#0.1.1, ansi-green#0.1.1, ansi-cyan#0.1.1, ansi-magenta#0.1.1, pretty-time#0.2.0)
├── base-config#0.3.3 (map-config#0.3.0, resolve-dir#0.1.0)
├── base-pipeline#0.1.4 (lazy-cache#0.2.7, extend-shallow#2.0.1, ansi-yellow#0.1.1, ansi-red#0.1.1, kind-of#2.0.1, stream-combiner#0.2.2, resolve-dir#0.1.0, through2#2.0.0)
├── base-argv#0.3.0 (arr-union#3.0.0, lazy-cache#0.2.7, extend-shallow#2.0.1, arrayify-compact#0.2.0, expand-args#0.3.1)
├── assemble-loader#0.2.6 (is-valid-glob#0.3.0, mixin-deep#1.1.3, has-glob#0.1.1, file-contents#0.2.4, load-templates#0.10.2)
├── base-store#0.3.2 (extend-shallow#2.0.1, project-name#0.2.3, data-store#0.12.1)
├── matched#0.4.1 (async-array-reduce#0.1.0, is-valid-glob#0.3.0, arr-union#3.0.0, extend-shallow#2.0.1, resolve-dir#0.1.0, glob#6.0.4, bluebird#3.1.1)
├── base-list#0.1.4 (arr-union#3.0.0, lazy-cache#0.2.7, base-tree#0.1.0, extend-shallow#2.0.1, union-value#0.2.1, question-cache#0.3.5)
├── base-questions#0.2.3 (get-value#2.0.2, for-own#0.1.3, mixin-deep#1.1.3, to-choices#0.1.1, set-value#0.3.2, common-questions#0.1.1, micromatch#2.3.7, question-store#0.3.2)
├── parser-front-matter#1.3.0 (lazy-cache#0.2.7, extend-shallow#2.0.1, gray-matter#2.0.2)
└── assemble-core#0.8.0 (assemble-render-file#0.3.1, assemble-streams#0.3.0, templates#0.9.5, assemble-fs#0.3.4, base-tasks#0.1.2)
Then I've added the task to my gruntfile:
grunt.loadNpmTasks('assemble' );
But every time I try to run it, I get a problem that the assemble module can't be found - this is from running grunt -v. All the other modules work by the way.
Registering "assemble" local Npm module tasks.
Reading /Users/Documents/Projects/OCSCommerce/prototype/web/themes/default/build/node_modules/assemble/package.json...OK
Parsing /Users/Documents/Projects/OCSCommerce/prototype/web/themes/default/build/node_modules/assemble/package.json...OK
>> Local Npm module "assemble" not found. Is it installed?
Loading "Gruntfile.js" tasks...OK
+ default, prototype, prototypeFull
Can anyone suggest what could be wrong?
Well the answer was sort of straightforward. The documentation page must be out of date (http://assemble.io/docs/Installation.html) - I found the info deep in the release notes of the git repository!
https://github.com/assemble/assemble/#release-history
"Assemble was completely re-written from the ground-up as a standalone node.js library and is no longer a grunt plugin. Grunt plugin support has been moved to grunt-assemble. Please see that repo for additional details."
It probably should have at least an update to the github readme if not the main documentation! Anyway, I installed grunt-assemble and it's working now....

Resources