0
votes

I'm trying to configure a DevOps pipeline build stage for building a container using the IBM Container Service builder.

I'm trying to build a docker image that sits inside a sub-folder /server inside the repository:

$ tree keycloak
keycloak
├── adapter-wildfly
│   ├─ ...
├── server
│   ├── Dockerfile
│   ├── ...
├── ...

At the top of my Build Script, I thought I could set the folder by setting the WORKSPACE environment variable:

export WORKSPACE=${WORKSPACE}/server

However, the build fails. At the end of the log file, I see:

2017-07-06 15:39:32 UTC : Dockerfile not found in project

The git project containing the Dockerfile that I'm trying to build is: https://github.com/jboss-dockerfiles/keycloak


Update:

I've put a (nasty) workaround in that works for now, but I'd rather have a less hacky solution. In my deployment script, I'm moving the folder that contains the Dockerfile into the parent folder:

...

# hacky workaround to build a Dockerfile not in the top level folder
mv ${WORKSPACE}/server/* .

if [ -f Dockerfile ]; then 
...
1

1 Answers

0
votes

The build script by default looks for the Dockerfile in the current directory, but then builds it from the fully qualified WORKSPACE. So you need to update the WORKSPACE and change into the new workspace directory:

export WORKSPACE=${WORKSPACE}/server
cd ${WORKSPACE}