-
For a better understanding, here is the current state of the
.onedev-buildspec.ymlfile:version: 13 jobs: - name: build steps: - !CheckoutStep name: checkout cloneCredential: !DefaultCredential {} withLfs: false withSubmodules: false condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL - !CommandStep name: build using dockerfile image: yobasystems/alpine-docker commands: - echo @project_name@ useTTY: true condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL retryCondition: never maxRetries: 3 retryDelay: 30 cpuRequirement: 500 memoryRequirement: 256 timeout: 3600 -
Previous Value Current Value Using a dockerfile
Building a docker image using a dockerfile then pushing it to my registry
-
I just wrote a tutorial on this:
https://code.onedev.io/projects/162/blob/main/pages/build-image.md?initial-new-path=build-image.md
Let me know if you encounter any problems.
-
Thanks Robin for responding so fast. I had a look at the code and am puuzzled by this line in the build CI step:

My question was and still is: what is the path of the
dockerfile? I do not see it here either... -
When a command step is executed, the current directory is repository root. So if you add a
lscommand to list files of current directory, you will seeDockerfilethere along side with other files in the repository root. -
Thanks for the prompt response. That should be written in bold on top of your documentation IMO ;o))
-
Thanks for the suggestion. Will make this information explicit.
-
So I have changed my code to display subfolders of the ``root` folder:
version: 13 jobs: - name: build jobExecutor: srv-shell steps: - !CheckoutStep name: checkout cloneCredential: !DefaultCredential {} withLfs: false withSubmodules: false condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL - !CommandStep name: build using dockerfile image: yobasystems/alpine-docker commands: - find /root -type d useTTY: true condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL retryCondition: never maxRetries: 3 retryDelay: 30 cpuRequirement: 500 memoryRequirement: 256 timeout: 3600Here is what I get: I cannot see the files from the Git repo...
08:47:39Waiting for resources... 08:47:39Executing job with executor 'srv-shell'... 08:47:39Allocating job caches... 08:47:39Copying job dependencies... 08:47:39Running step "checkout"... 08:47:39Checking out code... 08:47:39Step "checkout" is successful 08:47:39Running step "build using dockerfile"... 08:47:39/root 08:47:39/root/.config 08:47:39/root/.config/jgit 08:47:39/root/.ssh 08:47:39/root/.java 08:47:39/root/.java/fonts 08:47:39/root/.java/fonts/1.8.0_292 08:47:39/root/bin 08:47:39Step "build using dockerfile" is successful 08:47:40Job finishedWhat am I doing wrong?
-
I mean repository root, not the literal directory
/root. Change your commandfind /root -type das a simplelsto list content of current directory, you will see all files in the repository root (or top level directory of git repo) -
Oh OK, get it now... And I can confirm it is the case. Thanks!
-
Previous Value Current Value Open
Closed
| Type |
Question
|
| Priority |
Normal
|
| Assignee |
Hi, and thanks for this amazing project I have discovered today. My only criticism would be for the documentation I find lacking and messy.
For example, I could not find the answers to this very basic question: what are the steps involved to buid a docker image from a dockerfile then push it to a self hosted registry?
Here is what I did:
Dockerfileincluded.onedev-buildspec.ymlfileyobasystems/alpine-docker, which is an image including dockerdockerfileso that I am able to execute adocker build?Please help because I am sure the solution is at hands, only difficult to find in the documentation, which is frustrating. Thanks. Stephen