-
Notifications
You must be signed in to change notification settings - Fork 88
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
Docker build fails on the first line #39
Comments
Did you run |
I have the exact same problem.
|
hmm, I'm not sure what your issue is then. given that this docker image hasn't been updated in a while, I shared a solution (and there are others) on this thread - #38 (comment) hope either solution listed can help |
I am pretty sure the problem is that the onbuild tag on docker hub contains the same image like the latest tag, which it should not. It is supposed to contain the result of https://github.com/gatsbyjs/gatsby-docker/blob/master/Dockerfile.onbuild but it does not. Instead both images are a result of https://github.com/gatsbyjs/gatsby-docker/blob/master/Dockerfile which is only supposed to be used for the latest tag. |
I solved the problem by doing a custom Dockerfile based on nginx image. The files are working 100% |
Do check the .dockerignore file too. |
This issue is still reproducible and prevents new users from being able to make use of the docker image. Steps to reproduce: mytmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'devreprogatsby')
cd $mytmpdir
npm i -g gatsby-cli
gatsby new gardner
cd gardner/
cat << EOF > .dockerignore
.cache/
node_modules/
public/
EOF
cat << EOF > Dockerfile
FROM gatsbyjs/gatsby:onbuild as build
FROM gatsbyjs/gatsby
COPY --from=build /app/public /pub
EOF
gatsby build
docker build -t gh-issue-39 .
echo "Be sure to remove the temporary files: "
echo rm -rf $mytmpdir This results in: Sending build context to Docker daemon 1.519MB
Step 1/3 : FROM gatsbyjs/gatsby:onbuild as build
# Executing 1 build trigger
ADD failed: stat /var/lib/docker/tmp/docker-builder209143335/public: no such file or directory |
I also have this issue. |
Whn I try this I get Step 9/9 : COPY docker/vhost.conf /etc/nginx/conf.d/default.conf Earlier in the build I do get |
I totally agree with this. My solution was to build the image and host it in docker hub. If someone wants to use it as well, just replace To repleat my steps and host image on your own, create a repo to docker hub and then run locally:
and replace |
why are you using gatsby outside of the container? i'm so confuse. I would have thougt this defeats the whole point of docker. |
@airtonix the use case is to develop locally using the docker container and then deploy the code to production using the docker container. This is a selling point of docker and a common use case. It allows the developer to use specific versions of dependencies on the dev machine that may be incompatible with other projects they are working on. |
Any news about fixing this bug? |
And check the |
Yes it will works for local development but not for the CI/CD environments where you dont have npm installed on the docker hosts. |
My file structure looks like this and there is no "app" folder. I just copied Dockerfile and .dockerignore to the root and tried to build according to the readme.
I am getting the following error
The text was updated successfully, but these errors were encountered: