Skip to content

Instantly share code, notes, and snippets.

@NogaMan
Last active August 17, 2021 04:59
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save NogaMan/3ae6bd88e8ae063ab6da56bc36659c7d to your computer and use it in GitHub Desktop.
Save NogaMan/3ae6bd88e8ae063ab6da56bc36659c7d to your computer and use it in GitHub Desktop.
Gatsby Dockerfile
.cache/
node_modules/
public/
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
autoindex off;
charset urtf-8;
error_page 404 /404.html;
location ~* \.(html)$ {
add_header Cache-Control "no-store";
expires off;
}
rewrite ^([^.\?]*[^/])$ $1/ permanent;
try_files $uri $uri/ $uri/index.html =404;
}
FROM node:13.8.0 as front
WORKDIR /app
COPY ./ /app/
RUN yarn install
RUN yarn run build
FROM nginx:1.17.8-alpine
RUN rm -rf /usr/share/nginx/html
COPY --from=front /app/public/ /usr/share/nginx/html
COPY default.conf /etc/nginx/conf.d/default.conf
@KevinBurton
Copy link

I get:

Step 9/9 : COPY docker/vhost.conf /etc/nginx/conf.d/default.conf
COPY failed: stat /var/lib/docker/tmp/docker-builder704808398/docker/vhost.conf: no such file or directory
error Command failed with exit code 1.

@shihKaiHung
Copy link

Step 9/9 : COPY docker/vhost.conf /etc/nginx/conf.d/default.conf
COPY failed: stat /var/lib/docker/tmp/docker-builder697431010/docker/vhost.conf: no such file or directory

@NogaMan
Copy link
Author

NogaMan commented Sep 30, 2020

Change the line 12 of the Dockerfile (COPY docker/vhost.conf /etc/nginx/conf.d/default.conf) with the followingCOPY default.conf /etc/nginx/conf.d/default.conf
UPD: I edited this gist with the fixed line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment