Skip to content

Commit

Permalink
oops this should have been pushed earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
Npfries committed Jun 26, 2023
1 parent 25a4397 commit ec581ed
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ CMD []

FROM builder AS start

ENTRYPOINT [ "npm", "run", "start" ]
ENTRYPOINT [ "npm", "run", "start:docker" ]

FROM base AS dev

ENTRYPOINT ["npm", "run", "dev"]
ENTRYPOINT ["npm", "run", "dev:docker"]

FROM node:18-alpine AS prod

Expand All @@ -39,7 +39,7 @@ COPY --from=base /app/node_modules/ ./node_modules/
COPY --from=base /app/public/ ./public/
COPY --from=builder /app/.next/ ./.next/

ENTRYPOINT ["npm", "run", "start"]
ENTRYPOINT ["npm", "run", "start:docker"]

FROM httpd:2.4 AS prod_static

Expand Down
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
start:
start_latest:
docker compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.start.yml -p my_project up -d --no-build --pull always
docker rmi $$(docker images -f "dangling=true" -q)

start_local:
docker compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.start.yml -p my_project up -d --build
docker rmi $$(docker images -f "dangling=true" -q)

dev:
docker compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.dev.yml -p my_project up -d --build
docker rmi $$(docker images -f "dangling=true" -q)

prod:
docker compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.prod.yml -p my_project up -d --build
docker rmi $$(docker images -f "dangling=true" -q)

prod_static:
docker compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.prod_static.yml -p my_project up -d --build
docker rmi $$(docker images -f "dangling=true" -q)

build:
# "ENOTIMPLEMENTEDYET: This should be configured according to your needs."
# docker build <???> .

stop:
docker compose -f ./docker/docker-compose.yml -p my_project down -v
docker compose -f ./docker/docker-compose.yml -p my_project down -v
docker rmi $$(docker images -f "dangling=true" -q)

cleanup:
docker rmi $$(docker images -f "dangling=true" -q)
4 changes: 1 addition & 3 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ services:
build:
target: dev
volumes:
- ../:/app/
ports:
- 3000:3000
- ../:/app/
4 changes: 1 addition & 3 deletions docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ services:
next_app:
container_name: "next_app-prod"
build:
target: prod
ports:
- 3000:3000
target: prod
4 changes: 1 addition & 3 deletions docker/docker-compose.prod_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ services:
next_app:
container_name: "next_app-prod_static"
build:
target: prod_static
ports:
- 3000:80
target: prod_static
4 changes: 1 addition & 3 deletions docker/docker-compose.start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ services:
next_app:
container_name: "next_app-start"
build:
target: start
ports:
- 3000:3000
target: start
5 changes: 2 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ services:
build:
context: ../
# target: // this is specifid in the other compose files
# ports:
# - 3000:3000 // this is specified in the other compose files
# // the mapping differs between files slightly
ports:
- 3000:80

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"private": true,
"scripts": {
"dev": "next dev",
"dev:docker": "next dev -p 80",
"build": "next build",
"start": "next start",
"start:docker": "next start -p 80",
"lint": "next lint",
"export": "next export"
},
Expand Down

0 comments on commit ec581ed

Please sign in to comment.