hrbr0k
(Hrbr0k)
November 27, 2021, 2:15am
1
This is how I try to make use of Github Actions in relation to the project being built in Docker. I have look on this site here: How do I specify the dockerfile location in my github action?
That which I would like out of it. It is that it makes use of the docker File that makes in my project.
I have built like this in relation to my files:
API
Service
Data
Test
However, it’s the case that my Docker is in the API section.
I have tried this:
name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build ./API/ --file Dockerfile --tag my-image-name:$(date +%s)
and i have try
docker build . --file Dockerfile --tag my-image-name:$(date +%s)
Error Says: unable to prepare context: unable to evaluate symlinks in Dockerfile path
rimelek
(Ákos Takács)
November 27, 2021, 10:45am
2
Try this:
docker build ./API/ --file ./API/Dockerfile --tag my-image-name:$(date +%s)
Dockerfile doe not have to be in the context. Using ./API/
as a context and Dockerfile
as file, Docker will look for Dockerfile in the root directory next to ./API/
hrbr0k
(Hrbr0k)
November 27, 2021, 4:58pm
3
Nice that I somehow got a little further because it did a lot of things that it has not done before.
However, an error still appears as you can see here in the picture.
Can it help you or need more information?
rimelek
(Ákos Takács)
November 27, 2021, 9:24pm
4
How could you build it locally? Have you tried it? If you refer the API folder in the Dockerfile that means your context must be outside the API folder. In that case only the Dockerfile should be referred starting with the folder:
docker build . --file API/Dockerfile --tag my-image-name:$(date +%s)
It looks like you tried every combination except the one you needed
If it works, then you were close.
2 Likes
anubz
(Anubz)
May 9, 2022, 3:44pm
6
That works! Thanks for sharing