Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with empty logs when using custom docker image #105

Closed
butaca opened this issue Sep 8, 2019 · 10 comments
Closed

Build fails with empty logs when using custom docker image #105

butaca opened this issue Sep 8, 2019 · 10 comments
Labels
archived This issue has been locked. bug Something isn't working

Comments

@butaca
Copy link

butaca commented Sep 8, 2019

I am trying to create a smaller image to build a hugo site. I tried the following two images:

FROM alpine:latest

ENV VERSION_HUGO=0.58.1

RUN apk add --no-cache bash curl git libc6-compat libstdc++ openssl

RUN curl -OL https://github.com/gohugoio/hugo/releases/download/v${VERSION_HUGO}/hugo_${VERSION_HUGO}_Linux-64bit.tar.gz && \
    tar -xf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz hugo -C / && \
    mv /hugo /usr/bin/hugo && \
    rm -rf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz

ENTRYPOINT [ "bash", "-c" ]
FROM amazonlinux:2

ENV VERSION_HUGO=0.58.1

RUN touch ~/.bashrc
RUN yum -y update && \
    yum -y install \
        curl \
        git \
        openssl-devel \
        openssh-clients \
        tar \
    yum clean all && \
    rm -rf /var/cache/yum

RUN curl -OL https://github.com/gohugoio/hugo/releases/download/v${VERSION_HUGO}/hugo_${VERSION_HUGO}_Linux-64bit.tar.gz && \
    tar -xf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz hugo -C / && \
    mv /hugo /usr/bin/hugo && \
    rm -rf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz

ENTRYPOINT [ "bash", "-c" ]

In both cases the build fails but the logs are empty.

@swaminator swaminator added the bug Something isn't working label Sep 10, 2019
@nimacks
Copy link
Contributor

nimacks commented Sep 10, 2019

@butaca , can your provide your appId and app region?

@butaca
Copy link
Author

butaca commented Sep 10, 2019

Thanks @nimacks for taking a look into this.

region: us-east-2
app id: d1sstkga163z5f (I guess this is the app id, the last part of the ARN).

Please, let me know if you need something else.

@nimacks
Copy link
Contributor

nimacks commented Sep 10, 2019

@butaca , can you ensure that your custom build image is complete?
It looks like you have 3 out of 4 of the required software required for custom builds to succeed.

  • cURL

  • git

  • OpenSSh

  • Node.JS+NPM

(NPM-based builds)Node.JS+NPM: Our build runner does not install Node, but instead relies on Node and NPM being installed in the image. This is only required for builds that require NPM packages or Node specific commands.

For more details see here https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html

@butaca
Copy link
Author

butaca commented Sep 10, 2019

@nimacks I didn’t install node since “This is only required for builds that require NPM packages or Node specific commands” and this is my case.

Should I try installing it even though I am not using it in my build?

@nimacks
Copy link
Contributor

nimacks commented Sep 10, 2019

I would like to rule out any unknown dependencies on Node.JS, so if you could install and then build that would be great. If that doesn't work then we can rule that out as the root cause.

@butaca
Copy link
Author

butaca commented Sep 11, 2019

@nimacks I added Node and the build is working correctly now. It seems that Node is mandatory after all. Thanks for your help.

For future readers, the working image is here: https://github.com/butaca/amplify-hugo

@butaca
Copy link
Author

butaca commented Sep 11, 2019

@nimacks although I managed to reduce the build time form 3 minutes to 1 minutes approximately, I suspect that using alpine instead of amazonlinux:2 should reduce the build time significantly.

This is what I tried: https://github.com/butaca/amplify-hugo/blob/cc68609581fb22d1cf7a348b47fcdc57a9f1e711/Dockerfile

But I am blind since the logs are empty. It would be great if amplify provided the logs when the build fails.

@nimacks
Copy link
Contributor

nimacks commented Sep 11, 2019

@butaca
I'm glad this is finally working for you. Alpine Linux has issues executing precompiled binaries and is currently not supported when using the custom build image feature.

We will look into making logs available to customers so you can have more insight into what's happening. If you're satisfied that you're issue has been resolved, please close this ticket. Thanks.

@butaca
Copy link
Author

butaca commented Sep 11, 2019

@nimacks Thanks for your help. I'm closing it now.

I would like to know if possible, if there is a lighter alternative to amazonlinux:2 as a base image.

@butaca butaca closed this as completed Sep 11, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the archived This issue has been locked. label Oct 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants