File tree 8 files changed +126
-0
lines changed
8 files changed +126
-0
lines changed Original file line number Diff line number Diff line change 21
21
dockerfile : images/NextjsShadcnDockerFile
22
22
- name : nextjs-vanilla
23
23
dockerfile : images/NextjsVanillaDockerFile
24
+ - name : nextjs-p5
25
+ dockerfile : images/NextjsP5DockerFile
24
26
name : Build ${{ matrix.app.name }} Image
25
27
runs-on : ubuntu-latest
26
28
permissions :
Original file line number Diff line number Diff line change
1
+ FROM python:3.11
2
+
3
+ WORKDIR /
4
+
5
+ RUN apt-get update && \
6
+ apt-get install -y --no-install-recommends \
7
+ curl \
8
+ wget \
9
+ zip \
10
+ unzip && \
11
+ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
12
+ apt-get install -y --no-install-recommends nodejs && \
13
+ apt-get clean && \
14
+ rm -rf /var/lib/apt/lists/*
15
+
16
+ RUN node --version && npm --version
17
+
18
+ RUN npx --yes create-next-app@latest frontend --js --tailwind --no-eslint --src-dir src --app --no-turbopack --yes && \
19
+ cd frontend && \
20
+ npm run build
21
+
22
+ RUN curl -o /frontend/next.config.mjs https://raw.githubusercontent.com/sshh12/prompt-stack/refs/heads/main/images/next.config.mjs.example && \
23
+ curl -o /frontend/public/sketch.js https://raw.githubusercontent.com/sshh12/prompt-stack/refs/heads/main/images/p5/sketch.js && \
24
+ curl -o /frontend/src/app/globals.css https://raw.githubusercontent.com/sshh12/prompt-stack/refs/heads/main/images/p5/globals.css && \
25
+ curl -o /frontend/src/app/layout.js https://raw.githubusercontent.com/sshh12/prompt-stack/refs/heads/main/images/p5/layout.js && \
26
+ curl -o /frontend/src/app/page.js https://raw.githubusercontent.com/sshh12/prompt-stack/refs/heads/main/images/p5/page.js
27
+
28
+ RUN ls -asl /frontend && \
29
+ ls -asl /frontend/src/app && \
30
+ cat /frontend/package.json
31
+
32
+ EXPOSE 3000
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ RUN npx --yes create-next-app@latest frontend --js --tailwind --no-eslint --src-
22
22
(echo "\n\n\n" | npx shadcn@latest add --yes --all) && \
23
23
npm run build
24
24
25
+ RUN curl -o /frontend/next.config.mjs https://raw.githubusercontent.com/sshh12/prompt-stack/refs/heads/main/images/next.config.mjs.example
26
+
25
27
RUN ls -asl /frontend && \
26
28
cat /frontend/package.json
27
29
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ RUN npx --yes create-next-app@latest frontend --js --tailwind --no-eslint --src-
19
19
cd frontend && \
20
20
npm run build
21
21
22
+ RUN curl -o /frontend/next.config.mjs https://raw.githubusercontent.com/sshh12/prompt-stack/refs/heads/main/images/next.config.mjs.example
23
+
22
24
RUN ls -asl /frontend && \
23
25
cat /frontend/package.json
24
26
Original file line number Diff line number Diff line change
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ .p5Canvas {
6
+ display : block !important ;
7
+ width : 100vw !important ;
8
+ height : 100vh !important ;
9
+ object-fit : contain !important ;
10
+ }
Original file line number Diff line number Diff line change
1
+ import './globals.css' ;
2
+ import Script from 'next/script' ;
3
+
4
+ export const metadata = {
5
+ title : 'p5.js App' ,
6
+ description : 'Generated by create next app' ,
7
+ } ;
8
+
9
+ export default function RootLayout ( { children } ) {
10
+ return (
11
+ < html lang = "en" >
12
+ < head >
13
+ < Script
14
+ src = "https://cdn.jsdelivr.net/npm/[email protected] /lib/p5.min.js"
15
+ strategy = "beforeInteractive"
16
+ />
17
+ < Script
18
+ src = "https://cdn.jsdelivr.net/npm/[email protected] /lib/addons/p5.sound.min.js"
19
+ strategy = "beforeInteractive"
20
+ />
21
+ < Script
22
+ src = "https://cdn.jsdelivr.net/npm/p5.brush"
23
+ strategy = "beforeInteractive"
24
+ />
25
+ < Script
26
+ src = "https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.2/addons/p5.easycam.min.js"
27
+ strategy = "beforeInteractive"
28
+ />
29
+ < Script
30
+ src = "https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.9/dat.gui.min.js"
31
+ strategy = "beforeInteractive"
32
+ />
33
+ < Script
34
+ src = "https://cdn.jsdelivr.net/npm/p5.collide2d"
35
+ strategy = "beforeInteractive"
36
+ />
37
+ </ head >
38
+ < body > { children } </ body >
39
+ < Script src = "/sketch.js" strategy = "afterInteractive" />
40
+ </ html >
41
+ ) ;
42
+ }
Original file line number Diff line number Diff line change
1
+ export default function Home ( ) {
2
+ return < > </ > ;
3
+ }
Original file line number Diff line number Diff line change
1
+ let x , y , vx , vy ;
2
+ let size = 30 ;
3
+
4
+ function setup ( ) {
5
+ createCanvas ( windowWidth , windowHeight ) ;
6
+ // Start circle in middle of screen
7
+ x = width / 2 ;
8
+ y = height / 2 ;
9
+ // Give it some initial velocity
10
+ vx = 3 ;
11
+ vy = 2 ;
12
+ }
13
+
14
+ function windowResized ( ) {
15
+ resizeCanvas ( windowWidth , windowHeight ) ;
16
+ }
17
+
18
+ function draw ( ) {
19
+ background ( 0 ) ;
20
+
21
+ // Update position
22
+ x += vx ;
23
+ y += vy ;
24
+
25
+ // Bounce off walls
26
+ if ( x + size / 2 > width || x - size / 2 < 0 ) vx *= - 1 ;
27
+ if ( y + size / 2 > height || y - size / 2 < 0 ) vy *= - 1 ;
28
+
29
+ // Draw circle
30
+ fill ( 255 ) ;
31
+ noStroke ( ) ;
32
+ circle ( x , y , size ) ;
33
+ }
You can’t perform that action at this time.
0 commit comments