-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to change the Context to other dir? #365
Comments
@HiColinn I'm not sure I understand. Do you have a link to your repo? |
Hi,thanks for you replay.I am a chinese,so my english is not good. I will try to tell you what I want.
|
Duplicate #346 |
I know It's duplicate,but it's long time bother me.can you help me? thank you very much. |
I've been having kind of the same problem: I am trying to build multiple images in one repository and when I define the context to be the path to the folder the So the structure of my project is like
In the docker-compose file I am able to build both images app:
build: ./app
image: user/name-app:latest
web:
build: ./web
image: user/name-web:latest So after following the guide I setup the Github Actions script using two builders steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
uses: docker/setup-buildx-action@v1
id: builder1
-
uses: docker/setup-buildx-action@v1
id: builder2
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push 1
id: docker_build1
uses: docker/build-push-action@v2
with:
builder: ${{ steps.builder1.outputs.name }}
context: ./app
file: ./app/Dockerfile
push: true
tags: user/name-app:latest
-
name: Build and push 2
id: docker_build2
uses: docker/build-push-action@v2
with:
builder: ${{ steps.builder2.outputs.name }}
context: ./web
file: ./web/Dockerfile
push: true
tags: user/name-web:latest But as soon as it reaches the first Docker build and push it raises the error When running the command used by the build and push step Removing The repository I'm working on is private so I won't' be able to share it entirely. |
Solved: adding - name: Checkout
uses: actions/checkout@v2 At the beginning of the Github actions file |
Can you share your file ,I add the check out ,it is also did not work |
@HiColinn I have a sample Actions markup file in my repository here: daffodilistic/docker-odoo@95352c3 |
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
uses: docker/setup-buildx-action@v1
id: builder1
-
uses: docker/setup-buildx-action@v1
id: builder2
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push 1
id: docker_build1
uses: docker/build-push-action@v2
with:
builder: ${{ steps.builder1.outputs.name }}
context: ./app
file: ./app/Dockerfile
push: true
tags: user/name-app:latest
-
name: Build and push 2
id: docker_build2
uses: docker/build-push-action@v2
with:
builder: ${{ steps.builder2.outputs.name }}
context: ./web
file: ./web/Dockerfile
push: true
tags: user/name-web:latest |
The default context is
.
,it's the root dir,but if my Dockerfile is in ./alpine/Dockerfile,and my root dir include multiple Dockerfile,I get the docker image by git msg.The text was updated successfully, but these errors were encountered: