Build Docker image with specific folder context using circleci/[email protected] orb

332 Views Asked by At

I have a repo with this structure:

repo
├── app1
│   ├── app
│   ├── requirements.txt
│   ├── Dockerfile
├── app2
│   ├── app
│   ├── requirements.txt
│   ├── Dockerfile
├── app3
│   ├── app
│   ├── requirements.txt
│   ├── Dockerfile

Let's say that I want to build image of app1

app1/Dockerfile:

FROM python:3.10-alpine

WORKDIR /app

COPY requirements.txt .

RUN apk add zlib-dev jpeg-dev gcc musl-dev libffi-dev

RUN pip3 install --no-cache-dir --upgrade -r requirements.txt

RUN rm requirements.txt

COPY app .

ENTRYPOINT ["python3"]

CMD ["script.py"]

My CircleCI file is:

version: 2.1

orbs:
  docker: circleci/[email protected]
  aws-ecr: circleci/[email protected]
  aws-ecs: circleci/[email protected]

[...]

workflows:
  main:
    jobs:
      - aws-ecr/build-and-push-image:
          platform: linux/arm64
          path: app1

During the CI build, I got this error:

> [7/7] COPY app .:
------
error: failed to solve: rpc error: code = Unknown desc = failed to compute cache key: "/app" not found: not found

It seems that during the build, the build context is repo and not app1. I saw that there is an argument build-path with this orb but when I do :

workflows:
  main:
    jobs:
      - aws-ecr/build-and-push-image:
          platform: linux/arm64
          path: app1
          build-path: app1

I got this error: Error calling job: 'aws-ecr/build-and-push-image' Unexpected argument(s): build-path

How can I specify the build context path with this orb?

0

There are 0 best solutions below