Dockerfile: ADD and COPY fails without error - dockerfile

When building the Dockerfile, no errors occur. This is true for COPY and ADD
Step 6/6 : COPY linter /etc/
---> 4cc83d919016
Successfully built 4cc83d919016
The image gets tagged and pushed as if everything worked correctly. When I attach to the container after pull and run, the directory /etc/linters is not present.
How to debug/resolve this?

Asking questions here is somehow catalytic...
The problem was, that my command just copied the content of linter to /etc/
What I wanted to achieve was, to add the complete dir to /etc. The correct add command would be:
ADD linter /etc/linter/

Related

How to make Dockerfile COPY work for windows absolute paths?

How do I make my COPY command work for absolute paths on Windows? I tried git-bash, cmd and powershell consoles to build with docker build -t custom-maven-image .
# Dockerfile
FROM maven:3-openjdk-11-slim
# these are three versions of copy command I tried
COPY C:/Users/myuser/.m2 /root/.m2
COPY /C/Users/myuser/.m2 /root/.m2
COPY /c/Users/myuser/.m2 /root/.m2
What I get is an error:
...
#5 ERROR: "/C/Users/myuser/.m2" not found: not found
UPDATE:
Thx #Jeremy for bugs references and now I see that docs clearly says:
COPY obeys the following rules:
The path must be inside the context of the build; you cannot
COPY ../something /something, because the first step of a docker build
is to send the context directory (and subdirectories) to the docker
daemon.
All the resources need to be in the dir that you run the build, i.e. where your Dockerfile is. You cant use an absolute path from elsewhere, think of it from the build perspective - where is the build happening - in the Dockerfile? It can run commands but those resources need to be public.
https://github.com/moby/moby/issues/4592
https://github.com/docker/compose/issues/4857

Github Actions path does not update

Right now, I'm trying to build a tool from source and use it to build a C++ project. I'm able to extract the tar file (gcc-arm-none-eabi). But, when I try to add it to path (using $GITHUB_PATH, not add-path), the path doesn't apply on my next action and I can't build the file. The error states that it can't find the gcc-arm-none-eabi toolset, which means that it didn't go to path.
Here's the script for the entrypoint of the first function (make is ran in the next action to allow for path to apply)
echo "Downloading ARM Toolchain"
# The one from apt isn't updated so I have to build from source
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -o gcc-arm-none-eabi.tar.bz2
tar -xjf gcc-arm-none-eabi.tar.bz2
echo "/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_PATH
I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found. What should I do?
I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found. What should I do?
First, PATH is not a command so if you want to print its value, it would be something like echo "${PATH}" or echo "$PATH"
Then, if you want to add a value to an existing environment variable, it would be something like
export PATH="${PATH}:/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin"
EDIT: seems not a valid way to add something to the path using Github Actions, meanwhile it seems correct in the question. To get more details: https://docs.github.com/en/free-pro-team#latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path . Thanks to Benjamin W. for pointing this out in the comments.
Finally I think it would be a better fit if you use a docker image that already contains that kind of dependancies (you could easily write your own Dockerfile if this image doesn't already exists). Github action is designed to use docker (or OCI containers) image that contains the dependancies you need to perform your build actions. You should take a look here: https://docs.github.com/en/free-pro-team#latest/actions/creating-actions/dockerfile-support-for-github-actions

Change in source code

I have two question
I have done some changes in C-backend of LLVM-2.9 source code. Now what I wanna is how can I reflect these changes in build folder?
What does make update do ? When I run this command this is what happen in my terminal.
arpit#arpit-HP-dx2480-MT-KL969AV:~/llvm1/build$ sudo make update
svn update /home/arpit/llvm1/llvm
Skipped '/home/arpit/llvm1/llvm'
svn: warning: '/home/arpit/llvm1/llvm' is not a working copy
Skipped '.'
make update updates LLVM and Clang and other sub-projects, so it's not what you need. What you do need is just make in the build folder. If any of the source files changed, make is supposed to pick it up and re-build the relevant files.
Maybe the specific changes you made are not picked up by make, have you added a new file? You can always try to build everything anew (e.g. make -B) and see if the change is included.

Where to start for writing a shell script for copying elements into main app xcode4

I am looking for some documentation or tutorial for copying files from a given directory into the app created by xcode at build time, before it is run.
At first I have tried to copy files into the derived directory, hoping that everything resides in there would be automatically added to the app, but I was wrong.
So I am looking for a script because the original dir may change its name, second the script could be customized by another xcode 4 user with its src dir path etc.
The things is I don't know how to start, which language etc. I am quite confident with shell script, but maybe there's a better option.
Second, I am trying to figure out which command could add a file in the already built app.
thanks
That answer didn't really help - the BUILT_PRODUCT_DIR isn't where most stuff goes.
Ultimately, I found you just need to do:
Add the following to the very end of your script (or get your script to write directly to the output location):
cp ${DERIVED_FILE_DIR}/[YOUR OUTPUT FILES] ${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
...but there's a lot of other things I tried. More thoughts and ideas here: http://red-glasses.com/index.php/tutorials/xcode4-a-script-that-creates-adds-files-to-your-project/
You want a Run Script or Copy Files build phase. Select your main project in the navigator, then select the app's target. Click the Build Phases tab. Click the Add Build Phase button at the bottom of the window and choose the appropriate phase.
By "appropriate" I mean if you really want to run a script, you'll use a Run Script build phase and use Xcode-provided environment variables like $BUILT_PRODUCT_DIR (see the documentation or hit build and examine the full output of an empty script in the build log) to figure out your target folder. If all you want to do is copy files (no real processing), the Copy Files build phase already knows how to locate the app bundle's proper folders depending on what you're copying (Resources, Frameworks, etc.).

django runserver error from SVN co

I have written a Django project which runs fine on the dev server. Although I am the only one working on it, I realized I should get some sort of version control going and placed the project on a network SVN. I assume the new process for working this project should be: checkout code from SVN, make changes, test, update, and commit back to SVN.
However, when I check out the code and attempt to run the dev server from the checked out SVN location, I get an error that "has no module named yadda.yadda". But, the module is there and it works fine when I run it from the original directory. Any thoughts? Any suggestions on a better work process?
Does your $PYTHONPATH shell variable reference a relative path? If so, the relative path may be incorrect when you change to the new directory.
You can also diff the contents of the two directories to ensure that your versioned copy is a duplicate of the original.
Check if your module has init.py
As George said check if module is on python path (import sys and print sys.path)