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

Docker build support. #20

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions dockerbuil.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Default build script
# Run Example: docker run --rm -p 8282:8282 jalr4ever/buitar
docker build -t jalr4ever/buitar:latest -f dockerfile/Dockerfile.pnpm .
jalr4ever marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions dockerbuild.nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Nginx version build script
# Run Example: docker run --rm -p 8282:8282 jalr4ever/buitar
docker build -t jalr4ever/buitar:latest -f dockerfile/Dockerfile.nginx .
26 changes: 26 additions & 0 deletions dockerfile/Dockerfile.nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# stage-1: build
FROM node:alpine as builder

RUN npm install -g pnpm

WORKDIR /app

COPY . .

RUN pnpm install --no-frozen-lockfile && \
pnpm build

# stage-2: package-static
FROM nginx:alpine

COPY --from=builder /app/packages/buitar/dist /usr/share/nginx/html/buitar
COPY --from=builder /app/packages/buitar-editor/dist /usr/share/nginx/html/buitar-editor
COPY --from=builder /app/packages/svg-chord/dist /usr/share/nginx/html/svg-chord
COPY --from=builder /app/packages/to-guitar/dist /usr/share/nginx/html/to-guitar
COPY --from=builder /app/packages/tone-player/dist /usr/share/nginx/html/tone-player

COPY dockerfile/nginx.conf /etc/nginx/nginx.conf

EXPOSE 8282 8283

CMD ["nginx", "-g", "daemon off;"]
23 changes: 23 additions & 0 deletions dockerfile/Dockerfile.pnpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:latest

RUN apt-get update && \
apt-get install -y curl git && \
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y nodejs

RUN npm install -g pnpm

WORKDIR /app

COPY . .

RUN pnpm install --no-frozen-lockfile

RUN pnpm build

# Only 8282
EXPOSE 8282

# By pnpm
CMD ["pnpm", "dev"]

32 changes: 32 additions & 0 deletions dockerfile/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
worker_processes auto;
events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;


server {
listen 8282;
server_name localhost;

location / {
root /app/packages/buitar/dist/;
index index.html;
}
}

server {
listen 8283;
server_name localhost;

location / {
root /app/packages/buitar-editor/dist/;
index index.html;
}
}
}
2 changes: 1 addition & 1 deletion packages/buitar-editor/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export default defineConfig({
server: {
port: 8283,
host: '0.0.0.0',
open: '/',
open: false,
}
})
2 changes: 1 addition & 1 deletion packages/buitar/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default defineConfig({
server: {
port: 8282,
host: '0.0.0.0',
open: '/',
open: false,
},
optimizeDeps: {
include: ['react', 'react-dom'],
Expand Down