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

initial commit #574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions nextjs-static-ngnix/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.git
node_modules
out
.next
.vscode
.prettier*
/eslintrc*
TODO
.editorconfig
**.log
34 changes: 34 additions & 0 deletions nextjs-static-ngnix/dockerfile
Original file line number Diff line number Diff line change
@@ -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;"]