ljfranklin / terraform-resource

A concourse resource to create infrastructure via Terraform
MIT License
185 stars 85 forks source link

Building image from Dockerfile - COPY failed: no source files were specified #182

Closed welo78 closed 1 year ago

welo78 commented 1 year ago

Hello all, first of all thank you for this amazing terraform resource.

Secondly, I am having hard time wrapping my head around issue I have with building your terraform resource from dockerfile. I was under the impression that by running the docker build command with your dockerfile an image should be created which then can be used for concourse pipelien purposes.

As you can see it keeps failing on Step 10/12 : COPY $TARGETARCH/terraform/* /usr/local/bin/ COPY failed: no source files were specified

Am I missing something ? I tried running your dockerfile on both Windows and Ubuntu docker engine.


root@ubuntu:/home/ubuntu/Containers# docker build -t terraform:v1 ./
Sending build context to Docker daemon  4.096kB
Step 1/12 : FROM alpine:latest
 ---> 49176f190c7e
Step 2/12 : ARG TARGETARCH=amd64
 ---> Using cache
 ---> a6b753cb64d8
Step 3/12 : RUN apk update &&     apk add ca-certificates git bash openssh-client curl
 ---> Using cache
 ---> 0146f46b14f0
Step 4/12 : RUN if [ "${TARGETARCH}" = "amd64" ]; then     wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub &&     wget -q -O /tmp/glibc.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk &&     wget -q -O /tmp/glibc-bin.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-bin-2.32-r0.apk;   elif [ "${TARGETARCH}" = "arm64" ]; then     wget -q -O /etc/apk/keys/ljfranklin-glibc.pub https://github.com/ljfranklin/alpine-pkg-glibc/releases/download/2.32-r0-arm64/ljfranklin-glibc.pub &&     wget -q -O /tmp/glibc.apk https://github.com/ljfranklin/alpine-pkg-glibc/releases/download/2.32-r0-arm64/glibc-2.32-r0.apk &&     wget -q -O /tmp/glibc-bin.apk https://github.com/ljfranklin/alpine-pkg-glibc/releases/download/2.32-r0-arm64/glibc-bin-2.32-r0.apk;   fi;   apk add --force-overwrite /tmp/glibc.apk &&   apk add /tmp/glibc-bin.apk &&   rm -rf /tmp/glibc.apk &&   rm -rf /tmp/glibc-bin.apk
 ---> Using cache
 ---> 4355a4ac661d
Step 5/12 : RUN mkdir -p $HOME/.ssh
 ---> Using cache
 ---> 0adc6061824d
Step 6/12 : RUN echo "StrictHostKeyChecking no" >> $HOME/.ssh/config
 ---> Using cache
 ---> c493be101d1d
Step 7/12 : RUN echo "LogLevel quiet" >> $HOME/.ssh/config
 ---> Using cache
 ---> df5dae1e82ce
Step 8/12 : RUN chmod 0600 $HOME/.ssh/config
 ---> Using cache
 ---> 5a819fdfcd96
Step 9/12 : RUN mkdir -p /usr/local/share/terraform/plugins/github.com/ashald/stateful/1.2.0/linux_${TARGETARCH}/ &&   wget -O /usr/local/share/terraform/plugins/github.com/ashald/stateful/1.2.0/linux_${TARGETARCH}/terraform-provider-stateful_v1.2.0     "https://github.com/ashald/terraform-provider-stateful/releases/download/v1.2.0/terraform-provider-stateful_v1.2.0-linux-${TARGETARCH}" &&   chmod +x /usr/local/share/terraform/plugins/github.com/ashald/stateful/1.2.0/linux_${TARGETARCH}/terraform-provider-stateful_v1.2.0
 ---> Using cache
 ---> e0dd81a00295
Step 10/12 : COPY $TARGETARCH/terraform/* /usr/local/bin/
COPY failed: no source files were specified
ljfranklin commented 1 year ago

Sorry for the delayed response. Use this script to build the docker image: https://github.com/ljfranklin/terraform-resource/blob/master/scripts/docker-build. Ideally the dockerfile would be a self-contained build but this is an artifact of how the CI pipeline works.