Skip to content

Commit b461456

Browse files
committed
Fix #145 working on integration of nextjs (vercel) into the project
1 parent 9885742 commit b461456

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+10276
-70
lines changed

.github/workflows/test_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
- name: Checkout
1111
uses: actions/checkout@v1
1212
- name: Test
13-
run: docker network create project-network && docker-compose build && docker-compose up --exit-code-from web-test
13+
run: docker network create project-network && docker-compose build && docker compose up --exit-code-from web-test

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
\.idea
22
\docker-python/project/base
3+
\docker-nextjs/.next
34
python_app.log
45
*.pyc

docker-compose.yml

+78-69
Original file line numberDiff line numberDiff line change
@@ -213,78 +213,87 @@ services:
213213
depends_on:
214214
- mongo
215215

216-
# A virtual book library
217-
web-book-collection:
218-
build:
219-
context: ./docker-python
220-
args:
221-
requirements: /root/flask-mongodb-example/python/bookcollection/requirements.txt
222-
environment:
223-
- PYTHONUNBUFFERED=1
216+
web-photo-process-ui:
217+
build: ./docker-nextjs
224218
ports:
225-
- "86:5000"
226-
entrypoint: python /root/flask-mongodb-example/python/bookcollection/bookcollection.py
227-
depends_on:
228-
- mongo
229-
- web-users
230-
231-
# Wame functionality as web-users but build with fastapi
232-
# runs with gunicorn on two processor cores [-w 2]
233-
web-users-fast-api:
234-
build:
235-
context: ./docker-python
236-
args:
237-
requirements: /root/flask-mongodb-example/python/fastapidemo/requirements.txt
238-
ports:
239-
- "88:5000" # port 87 is restricted in browsers
240-
entrypoint: gunicorn -w 2 -k uvicorn.workers.UvicornH11Worker --chdir /root/flask-mongodb-example/python/fastapidemo --bind 0.0.0.0:5000 --log-level debug users-fastapi:app
219+
- "3001:3000"
220+
environment:
221+
- NEXT_PUBLIC_API_URL=http://localhost:85
241222
depends_on:
242-
- mongo
223+
- web-photo-process
243224

244-
# A two player tic tac toe game written in flask using flask_session. It has a simple UI
245-
web-tictactoe:
246-
build:
247-
context: ./docker-python
248-
args:
249-
requirements: /root/flask-mongodb-example/python/requirements.txt
250-
ports:
251-
- "89:5000"
252-
entrypoint: python /root/flask-mongodb-example/python/tictactoe/tictactoe.py
253-
254-
255-
# GraphQl implementation of CRUD users
256-
web-users-graphql:
257-
build:
258-
context: ./docker-python
259-
args:
260-
requirements: /root/flask-mongodb-example/python/graphql/requirements.txt
261-
ports:
262-
- "90:5000"
263-
entrypoint: python /root/flask-mongodb-example/python/graphql/users.py
264-
265-
# Used to test build of services
266-
web-test:
267-
image: alpine
268-
depends_on:
269-
- web-random
270-
- web-random-pypy
271-
- web-users
272-
- background-mqtt
273-
- web-fulltext-search
274-
- web-geolocation-search
275-
- web-baesian
276-
- web-photo-process
277-
- web-book-collection
278-
- web-users-fast-api
279-
- web-users-graphql
280-
- influxdb
281-
- chronograf
282-
- grafana
283-
- mongo
284-
- mqtt
285-
- krakend
286-
- web-tictactoe
287-
- redis
225+
# # A virtual book library
226+
# web-book-collection:
227+
# build:
228+
# context: ./docker-python
229+
# args:
230+
# requirements: /root/flask-mongodb-example/python/bookcollection/requirements.txt
231+
# environment:
232+
# - PYTHONUNBUFFERED=1
233+
# ports:
234+
# - "86:5000"
235+
# entrypoint: python /root/flask-mongodb-example/python/bookcollection/bookcollection.py
236+
# depends_on:
237+
# - mongo
238+
# - web-users
239+
#
240+
# # Wame functionality as web-users but build with fastapi
241+
# # runs with gunicorn on two processor cores [-w 2]
242+
# web-users-fast-api:
243+
# build:
244+
# context: ./docker-python
245+
# args:
246+
# requirements: /root/flask-mongodb-example/python/fastapidemo/requirements.txt
247+
# ports:
248+
# - "88:5000" # port 87 is restricted in browsers
249+
# entrypoint: gunicorn -w 2 -k uvicorn.workers.UvicornH11Worker --chdir /root/flask-mongodb-example/python/fastapidemo --bind 0.0.0.0:5000 --log-level debug users-fastapi:app
250+
# depends_on:
251+
# - mongo
252+
#
253+
# # A two player tic tac toe game written in flask using flask_session. It has a simple UI
254+
# web-tictactoe:
255+
# build:
256+
# context: ./docker-python
257+
# args:
258+
# requirements: /root/flask-mongodb-example/python/requirements.txt
259+
# ports:
260+
# - "89:5000"
261+
# entrypoint: python /root/flask-mongodb-example/python/tictactoe/tictactoe.py
262+
#
263+
#
264+
# # GraphQl implementation of CRUD users
265+
# web-users-graphql:
266+
# build:
267+
# context: ./docker-python
268+
# args:
269+
# requirements: /root/flask-mongodb-example/python/graphql/requirements.txt
270+
# ports:
271+
# - "90:5000"
272+
# entrypoint: python /root/flask-mongodb-example/python/graphql/users.py
273+
#
274+
# # Used to test build of services
275+
# web-test:
276+
# image: alpine
277+
# depends_on:
278+
# - web-random
279+
# - web-random-pypy
280+
# - web-users
281+
# - background-mqtt
282+
# - web-fulltext-search
283+
# - web-geolocation-search
284+
# - web-baesian
285+
# - web-photo-process
286+
# - web-book-collection
287+
# - web-users-fast-api
288+
# - web-users-graphql
289+
# - influxdb
290+
# - chronograf
291+
# - grafana
292+
# - mongo
293+
# - mqtt
294+
# - krakend
295+
# - web-tictactoe
296+
# - redis
288297

289298
volumes:
290299
grafana_data: {}

docker-nextjs/Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM node:18 AS builder
2+
3+
4+
RUN git clone --branch nextjs https://github.com/danionescu0/docker-flask-mongodb-example.git app
5+
6+
WORKDIR /app
7+
8+
# Copy package files separately for better caching for dev
9+
#COPY package*.json ./
10+
11+
# Install dependencies
12+
RUN npm install
13+
14+
# Copy the rest of the project only for dev env
15+
#COPY . .
16+
17+
18+
# Expose the port and start the development server
19+
EXPOSE 3000
20+
21+
CMD ["npm", "run", "dev", "--", "-H", "0.0.0.0"]

docker-nextjs/app/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:85';
2+

docker-nextjs/app/globals.css

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
body {
6+
font-family: Arial, Helvetica, sans-serif;
7+
}
8+
9+
@layer utilities {
10+
.text-balance {
11+
text-wrap: balance;
12+
}
13+
}
14+
15+
@layer base {
16+
:root {
17+
--background: 0 0% 100%;
18+
--foreground: 0 0% 3.9%;
19+
--card: 0 0% 100%;
20+
--card-foreground: 0 0% 3.9%;
21+
--popover: 0 0% 100%;
22+
--popover-foreground: 0 0% 3.9%;
23+
--primary: 0 0% 9%;
24+
--primary-foreground: 0 0% 98%;
25+
--secondary: 0 0% 96.1%;
26+
--secondary-foreground: 0 0% 9%;
27+
--muted: 0 0% 96.1%;
28+
--muted-foreground: 0 0% 45.1%;
29+
--accent: 0 0% 96.1%;
30+
--accent-foreground: 0 0% 9%;
31+
--destructive: 0 84.2% 60.2%;
32+
--destructive-foreground: 0 0% 98%;
33+
--border: 0 0% 89.8%;
34+
--input: 0 0% 89.8%;
35+
--ring: 0 0% 3.9%;
36+
--chart-1: 12 76% 61%;
37+
--chart-2: 173 58% 39%;
38+
--chart-3: 197 37% 24%;
39+
--chart-4: 43 74% 66%;
40+
--chart-5: 27 87% 67%;
41+
--radius: 0.5rem;
42+
--sidebar-background: 0 0% 98%;
43+
--sidebar-foreground: 240 5.3% 26.1%;
44+
--sidebar-primary: 240 5.9% 10%;
45+
--sidebar-primary-foreground: 0 0% 98%;
46+
--sidebar-accent: 240 4.8% 95.9%;
47+
--sidebar-accent-foreground: 240 5.9% 10%;
48+
--sidebar-border: 220 13% 91%;
49+
--sidebar-ring: 217.2 91.2% 59.8%;
50+
}
51+
.dark {
52+
--background: 0 0% 3.9%;
53+
--foreground: 0 0% 98%;
54+
--card: 0 0% 3.9%;
55+
--card-foreground: 0 0% 98%;
56+
--popover: 0 0% 3.9%;
57+
--popover-foreground: 0 0% 98%;
58+
--primary: 0 0% 98%;
59+
--primary-foreground: 0 0% 9%;
60+
--secondary: 0 0% 14.9%;
61+
--secondary-foreground: 0 0% 98%;
62+
--muted: 0 0% 14.9%;
63+
--muted-foreground: 0 0% 63.9%;
64+
--accent: 0 0% 14.9%;
65+
--accent-foreground: 0 0% 98%;
66+
--destructive: 0 62.8% 30.6%;
67+
--destructive-foreground: 0 0% 98%;
68+
--border: 0 0% 14.9%;
69+
--input: 0 0% 14.9%;
70+
--ring: 0 0% 83.1%;
71+
--chart-1: 220 70% 50%;
72+
--chart-2: 160 60% 45%;
73+
--chart-3: 30 80% 55%;
74+
--chart-4: 280 65% 60%;
75+
--chart-5: 340 75% 55%;
76+
--sidebar-background: 240 5.9% 10%;
77+
--sidebar-foreground: 240 4.8% 95.9%;
78+
--sidebar-primary: 224.3 76.3% 48%;
79+
--sidebar-primary-foreground: 0 0% 100%;
80+
--sidebar-accent: 240 3.7% 15.9%;
81+
--sidebar-accent-foreground: 240 4.8% 95.9%;
82+
--sidebar-border: 240 3.7% 15.9%;
83+
--sidebar-ring: 217.2 91.2% 59.8%;
84+
}
85+
}
86+
87+
@layer base {
88+
* {
89+
@apply border-border;
90+
}
91+
body {
92+
@apply bg-background text-foreground;
93+
}
94+
}

docker-nextjs/app/layout.tsx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { Metadata } from 'next'
2+
import { Inter } from 'next/font/google'
3+
import './globals.css'
4+
5+
const inter = Inter({ subsets: ['latin'] })
6+
7+
export const metadata: Metadata = {
8+
title: 'Image Processing UI',
9+
description: 'A simple UI for image processing API',
10+
}
11+
12+
export default function RootLayout({
13+
children,
14+
}: Readonly<{
15+
children: React.ReactNode
16+
}>) {
17+
return (
18+
<html lang="en">
19+
<body className={inter.className}>
20+
<main className="min-h-screen bg-gray-100">
21+
{children}
22+
</main>
23+
</body>
24+
</html>
25+
)
26+
}
27+

0 commit comments

Comments
 (0)