Comments (9)
@eevers-avisi - great news! This has been merged in. Make sure you're using v3
of this action in your workflow yaml.
FYI @techpool - working directory support has been officially added in v3
.
from docker-build-push.
@eevers-avisi - I've been able to get this working on a branch with a new optional directory
input. Can you give the below example a try and let me know if it works for your purposes? Note that if a standard Dockerfile
already exists in the working directory, you won't have to specify it.
- uses: mr-smithers-excellent/docker-build-push@add-build-dir
with:
image: 'mrsmithers/hello-world'
tag: 'latest'
registry: 'docker.io'
dockerfile: 'working-dir/Dockerfile.dir'
directory: 'working-dir'
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
from docker-build-push.
@eevers-avisi - I've updated the branch to use the directory
input directly in the docker build
command instead of using cd
. For instance, if you pass working-dir
and Dockerfile.root
, it will now produce a build command that looks like:
docker build -t your-image:tag -f Dockerfile.root working-dir
Can you give this another try and let me know? If it doesn't work, if you could let me know the project structure you're working with, I can try to emulate on my side. Thanks!
from docker-build-push.
@mr-smithers-excellent It's working correctly right now!
If still needed for further optimising this enhancement, this is the structure of our project. The goals is to build a Docker image using the Dockerfile.subdir
(and other files) inside subdirectory
. Which is succesfully working with the latest version in @add-build-dir
:
|-- Dockerfile.root
|-- subdirectory
|-- Dockerfile.subdir
from docker-build-push.
I just saw your reaction on the following PR: #8
You said that by setting the working directory you should also achieve this. I did also try to do that before creating this issue. Unfortunately this didn't work.
from docker-build-push.
Hi @eevers-avisi - thanks for the feedback. Upon further research, it looks like you can't use working-directory
in conjunction with uses
, only with run
. So I'll need to make some changes to get this working. Would something like this fit your use case?
- uses: mr-smithers-excellent/docker-build-push@v3
with:
image: 'owner/image-name'
tag: 'latest'
registry: 'docker.io'
dockerfile: '../Dockerfile' # assuming Dockerfile is at root
directory: 'dir-name' # if running the build outside project root
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
from docker-build-push.
@mr-smithers-excellent Yes, your example would fit my use case
from docker-build-push.
I tried to use your example and fit in into our project. Unfortunately it still doesn't work for me. I did specify the directory containing the Dockerfile and other needed files with the new directory input. Also I did have to specify the Dockerfile because it took the Dockerfile in the root of our project if I didn't. It seems that the COPY steps in the Dockerfile are still trying to fetch the files from the root of our project, instead of from the specified directory. Also the logging shows that the build command still ends with a . instead of the passed directory.
from docker-build-push.
Can you give me an overview of what your project structure looks like?
from docker-build-push.
Related Issues (20)
- Set output warning when running this action HOT 7
- Github action Error: Dockerfile does not exist in location Dockerfile HOT 8
- Build The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. HOT 7
- Docker Push without build HOT 2
- Support for pull_request event
- Support for pull_request event HOT 6
- Output image SHA256 digest(s) HOT 4
- ERROR: failed to solve: Internal: header key "exclude-patterns" contains value with non-printable ASCII characters HOT 3
- Why is my organization's name a secret? HOT 1
- How do I find the correct registry and image name to use? HOT 2
- Any plan to support Azure Container Registries? HOT 4
- Exit Code 1 after pushing latest tag HOT 1
- Is it possible to cache node_modules that were installed in Dockerfile? HOT 1
- "Node.js 16 actions are deprecated" warning HOT 1
- Action fails pipeline if credentials are not supplied HOT 9
- Not working with Artifact Registry HOT 2
- Conditionally Setting `addLatest` does not work for truthy values HOT 1
- Why is there no switch to set whether to push all tags? HOT 4
- Input multiPlatform is set to true, skipping Docker push step HOT 2
- How to push latest tag only upon releases HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-build-push.