'Run docker build - Cant not found docker file
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
- Docker
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)
Solution 1:[1]
If I understand correctly the correct path to the Dockerfile
would be under the API
Also the context .
is at the end
docker build --file ./API/Dockerfile --tag my-image-name:$(date +%s) .
Solution 2:[2]
Try this with the "./" in front of dockerfile name:
docker build . --file ./Dockerfile --tag my-image-name:$(date +%s)
UPDATE:
After looking at Docker.com documents, I found the solution using Docker Compose. Just use:
docker-compose up
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tolis Gerodimos |
Solution 2 |