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

[IMPROVE] Dockerfile to support hot-reload #74

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
31 changes: 31 additions & 0 deletions app/Dockerfile.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Dockerfile

# Use node alpine as it's a small node image
FROM node:16-alpine


# Set /app as the working directory
WORKDIR /app

# Copy package.json and package-lock.json
# to the /app working directory
COPY package.json package-lock.json ./

# Install dependencies in /app
RUN npm i

# Copy the rest of our Next.js folder into /app
COPY next.config.js ./next.config.js
COPY apollo-client.js ./apollo-client.js

COPY pages ./pages
COPY public ./public
COPY styles ./styles
COPY components ./components
COPY lib ./lib

# Ensure port 3000 is accessible to our system
EXPOSE 3000

# Run npm run dev, as we would via the command line
CMD [ "npm", "run", "dev" ]
25 changes: 25 additions & 0 deletions app/docker-compose.development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# docker-compose.yml

version: "3"

services:
app:
image: docker-nextjs-dev
build:
dockerfile: Dockerfile.development
ports:
- "3000:3000"
networks:
- stagingnetwork
volumes:
- ./pages:/app/pages
- ./public:/app/public
- ./styles:/app/styles

networks:
stagingnetwork:
Dnouv marked this conversation as resolved.
Show resolved Hide resolved
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16
gateway: 172.28.0.1
2 changes: 1 addition & 1 deletion app/lib/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function getStrapiURL(path = "") {
return `${
process.env.NEXT_PUBLIC_STRAPI_API_URL || "http://127.0.0.1:1337"
process.env.NEXT_PUBLIC_STRAPI_API_URL || " http://172.28.0.1:1337/api"
}/api${path}`;
}

Expand Down