Closed terox closed 4 years ago
I am guessing you are using scratch
as the final image. Change it to lambci/lambda:provided
and it works. Related to changes introduced in #75
Oh that's an interesting point @gocebo, maybe @shouze is there anything to improve in the instructions or docs if scratch
changes a few things for users? I'm not really sure about the impact here.
@terox could you please either send the PR as a draft of give me an example of how to reproduce? :angel:
@terox Downloading the latest repo and running make layers
reproduces the problem but this line is the issue
https://github.com/brefphp/extra-php-extensions/blob/cc8428c829d28dfccc63c7495668e58bedbf2715/Makefile#L48 since there is no tar entrypoint in scratch
.
@terox Downloading the latest repo and running
make layers
reproduces the problem but this line is the issuehttps://github.com/brefphp/extra-php-extensions/blob/cc8428c829d28dfccc63c7495668e58bedbf2715/Makefile#L48 since there is no tar entrypoint in
scratch
.
Ok my fault indeed. The fix will be probably straight forward as docker already have a built in command to produce a tar from a docker image. Will send a fix 🔜
@gocebo os in the track. That line is the problematic. Waiting the fix. Thanks for the help. When all is ready I will try all again
Ok docker image save does not produces the output I expected, it will be a little more complicated.
# effectively produces a tar
docker image save bref/layers/gd-php-74 > output.tar
# But when I untar...
tar -x -f output.tar
# I obtain all the layers whith json files describing them
ls
02b29024ea229d5dc79752905acc6f41bff3465a2654ed63c0da0e41e9b72beb/
0f972130cc2b0ea162d574b9b0e07536bec0ec224b710a90ad62fd7225eb8982/
88592bfb09ca523eb8042d6d0cd5aa9431833ed2d2e2972581c973becf183b72/
eff5cd62635634639eb272f0ee96cd64668616870fa54efe1b0654007ba794de.json
manifest.json
repositories
# Especially this one that can be used to iterate over each layer to untar
cat manifest.json | jq -r '.[0].Layers'
[
"02b29024ea229d5dc79752905acc6f41bff3465a2654ed63c0da0e41e9b72beb/layer.tar",
"88592bfb09ca523eb8042d6d0cd5aa9431833ed2d2e2972581c973becf183b72/layer.tar",
"0f972130cc2b0ea162d574b9b0e07536bec0ec224b710a90ad62fd7225eb8982/layer.tar"
]
# And when I untar each one I obtain the reconstitution of the filesystem
# that we want to export as a layer in a zip file
So.. This means I cannot deploy the new layers. Since I need to run tar
.
Is there a workaround? Or should we create "scratch with tar"?
@Nyholm scratch with tar could be alpine for example, as scratch has no os, no libc and so on, this is an empty image.
As it's a bit harder to fix than expected with scratch (my previous comment), you can replace scratch everywhere by the smallest possible docker image, alpine for example (I've searched for a minimal tar
docker image but didn't find any).
Then I we will be able to rollback to scratch
but this time taking make layers into account.
Ok docker image save does not produces the output I expected, it will be a little more complicated.
# effectively produces a tar docker image save bref/layers/gd-php-74 > output.tar # But when I untar... tar -x -f output.tar # I obtain all the layers whith json files describing them ls 02b29024ea229d5dc79752905acc6f41bff3465a2654ed63c0da0e41e9b72beb/ 0f972130cc2b0ea162d574b9b0e07536bec0ec224b710a90ad62fd7225eb8982/ 88592bfb09ca523eb8042d6d0cd5aa9431833ed2d2e2972581c973becf183b72/ eff5cd62635634639eb272f0ee96cd64668616870fa54efe1b0654007ba794de.json manifest.json repositories # Especially this one that can be used to iterate over each layer to untar cat manifest.json | jq -r '.[0].Layers' [ "02b29024ea229d5dc79752905acc6f41bff3465a2654ed63c0da0e41e9b72beb/layer.tar", "88592bfb09ca523eb8042d6d0cd5aa9431833ed2d2e2972581c973becf183b72/layer.tar", "0f972130cc2b0ea162d574b9b0e07536bec0ec224b710a90ad62fd7225eb8982/layer.tar" ] # And when I untar each one I obtain the reconstitution of the filesystem # that we want to export as a layer in a zip file
I don't understand exactly what is the issue with "docker image save", but I understand that tar result tar contains all image files and not the raw "extension" or binary that was the expected behaviour? Sorry I am not an expert in Docker at this levels. In other case seems a little tricky issue but not impossible to solve :)
When we have all ready I can test the make layers
in my computer to ensure that is fine. I will not able to publish my extension as a PR because it was about msgpack
and it is merged now from other contributor. But, in any case I can send some feedback from this issue.
I think the issue is this:
When we use the docker images, we really want to use scratch
because it is small.
However, when one is creating aws layers, we are only interested in the files, so we use tar
to get the files from the docker image.
I can see if I'll write up a solution today.
@terox this is not impossible to solve, I have a good idea in fact on how to solve it :smile: : simply extract all the sub tar(s) of docker save image to reconstitute a zippable exported filesystem.
This is why I've exposed so far where I am in https://github.com/brefphp/extra-php-extensions/issues/80#issuecomment-707514769: to resume quickly on this issue when I'll find a time slot to dedicate :wink:
@Nyholm you hacker :clap: :pirate_flag:
@terox this is not impossible to solve, I have a good idea in fact on how to solve it : simply extract all the sub tar(s) of docker save image to reconstitute a zippable exported filesystem.
This is why I've exposed so far where I am in #80 (comment): to resume quickly on this issue when I'll find a time slot to dedicate
I understand much better the intentions! :)
Hello!
I am trying to test a new layer before send the PR, but when I execute the
make layers
docker shows me an error:I lost some hours trying to understand what is happening. Is only happening to me or maybe is general? I think that some is wrong in the main docker image
bref/build-php-XX
because seems thattar
command is not available. But I am not sure.Anybody can help me to fix it with some clue?
Thank you so much