BCDevOps / backup-container

A simple container for a simple backup strategy.
Apache License 2.0
42 stars 56 forks source link

Using RUN curl instead of ADD to resolve build Docker build issue #45

Closed chrismajewski closed 4 years ago

chrismajewski commented 4 years ago

backup-1-build

STEP 7: ARG GOCROND_VERSION=0.6.3 e55ddcc18af7ee9b5dea5822e3b9172f85bcee5eef6afb272e09d61d2013cdb8 STEP 8: ADD https://github.com/$SOURCE_REPO/go-crond/releases/download/$GOCROND_VERSION/go-crond-64-linux /usr/bin/go-crond error: build error: error building at STEP "ADD https://github.com/$SOURCE_REPO/go-crond/releases/download/$GOCROND_VERSION/go-crond-64-linux /usr/bin/go-crond": source can't be a URL for COPY

WadeBarnes commented 4 years ago

You shouldn't need to do that. What version of docker are you using?

WadeBarnes commented 4 years ago

Seems the recommendations on ADD vs COPY vs curl have changed; https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy

WadeBarnes commented 4 years ago

Although ADD is being used as is was intended in this case: Consequently, the best use for ADD is local tar file auto-extraction into the image, as in ADD rootfs.tar.xz /.

chrismajewski commented 4 years ago

Is that a tar? Source file looks like an executable dropped in the /bin directly

https://github.com/BCDevOps/go-crond/releases/download/0.6.3/go-crond-64-linux

WadeBarnes commented 4 years ago

Good catch.

chrismajewski commented 4 years ago

Hang-on, it worked first go. Now I'm seeing a curl error on repeated attempts. Investigating.

chrismajewski commented 4 years ago

Not sure how it worked the first time but it does now.

curl error 23, couldn't write to /usr/bin/

Dropped the curl command below the switch to root.

I'll repeat a few times to confirm and create a clean PR with one change when that's done.