mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
initial commit
This commit is contained in:
parent
8ff991327f
commit
3dfb16658b
10
nextjs-static-ngnix/.dockerignore
Normal file
10
nextjs-static-ngnix/.dockerignore
Normal file
|
@ -0,0 +1,10 @@
|
|||
.git
|
||||
node_modules
|
||||
out
|
||||
.next
|
||||
.vscode
|
||||
.prettier*
|
||||
/eslintrc*
|
||||
TODO
|
||||
.editorconfig
|
||||
**.log
|
34
nextjs-static-ngnix/dockerfile
Normal file
34
nextjs-static-ngnix/dockerfile
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Statically build nextjs, deploy on ngnix
|
||||
# To build:
|
||||
# docker build -t nextjs-static -f ./dockerfile .
|
||||
|
||||
# To run:
|
||||
# docker run --rm -e 'PORT=80' -p 80:80 -d --name nextjs-static nextjs-static:latest
|
||||
|
||||
FROM node:latest as builder
|
||||
|
||||
WORKDIR /app
|
||||
# install deps
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn --production --frozen-lockfile
|
||||
|
||||
#copy the directory after install is done
|
||||
|
||||
|
||||
COPY . .
|
||||
|
||||
#export
|
||||
RUN yarn next build && yarn next export
|
||||
|
||||
#stage2
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY nginx /etc/nginx/
|
||||
|
||||
# ## Remove default nginx index page
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# # Copy static files from the builder
|
||||
COPY --from=builder /app/out /usr/share/nginx/html
|
||||
|
||||
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
Loading…
Reference in New Issue
Block a user