kciter / aws-ecr-action

This Action allows you to create Docker images and push into a ECR repository.
MIT License
146 stars 116 forks source link

Fails when path is not . #22

Closed ksrisurapaneni closed 3 years ago

ksrisurapaneni commented 3 years ago

Hi,

When I give a custom folder path for Dockerfile in path attribute, docker build command seems to be failing with below error:

ex path: path: ${{ env.INPUT_PATH }} path: ${{ env.FILE_PATH }}

== START DOCKERIZE
"docker build" requires exactly 1 argument.
See 'docker build --help'.

Usage:  docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

I am not giving any arguments at all. Looking at entrypoint.sh, looks like the below function is missing path and $INPUT_PATH. Could that be the issue?

function main() {
  sanitize "${INPUT_ACCESS_KEY_ID}" "access_key_id"
  sanitize "${INPUT_SECRET_ACCESS_KEY}" "secret_access_key"
  sanitize "${INPUT_REGION}" "region"
  sanitize "${INPUT_ACCOUNT_ID}" "account_id"
  sanitize "${INPUT_REPO}" "repo"

  ACCOUNT_URL="$INPUT_ACCOUNT_ID.dkr.ecr.$INPUT_REGION.amazonaws.com"

Please let me know if I am doing something wrong.

Thanks, Keerti

ksrisurapaneni commented 3 years ago

Looks like path attribute doesn't work, so I removed that and added dockerfile attribute. But there seems to be a caveat, dockerfile attribute works only when I use the variable present in entrypoint.sh

dockerfile: "${{ env.INPUT_PATH }}/Dockerfile"

It returns an error when I store my path in a different variable:

dockerfile: "${{ env.FILE_NAME}}/Dockerfile"

== START DOCKERIZE
"docker build" requires exactly 1 argument.
See 'docker build --help'.

Usage:  docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Thanks, Keerti