barebones docker | pocketbase | hono | svelte
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
FROM node:22-alpine AS builder
|
||||
RUN corepack enable
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm --filter frontend build
|
||||
RUN pnpm --filter proxy build
|
||||
|
||||
FROM node:22-alpine
|
||||
RUN corepack enable && apk add --no-cache nginx
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/frontend/build ./frontend/build
|
||||
COPY --from=builder /app/proxy/dist ./proxy/dist
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/pnpm-lock.yaml ./
|
||||
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
|
||||
COPY docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
ENV FRONTEND_PORT=2080
|
||||
ENV PROXY_PORT=3456
|
||||
EXPOSE 3001
|
||||
CMD ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,8 @@
|
||||
FROM alpine:latest
|
||||
RUN apk add --no-cache curl unzip && \
|
||||
curl -L -o /tmp/pb.zip https://github.com/pocketbase/pocketbase/releases/download/v0.25.8/pocketbase_0.25.8_linux_amd64.zip && \
|
||||
unzip /tmp/pb.zip -d /usr/local/bin/ && \
|
||||
rm /tmp/pb.zip && \
|
||||
apk del curl unzip
|
||||
EXPOSE 8090
|
||||
CMD ["pocketbase", "serve", "--http=0.0.0.0:8090"]
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
PORT=${FRONTEND_PORT:-2080} node /app/frontend/build/index.js &
|
||||
PROXY_PORT=${PROXY_PORT:-3456} node /app/proxy/dist/index.js &
|
||||
|
||||
nginx -g 'daemon off;'
|
||||
@@ -0,0 +1,22 @@
|
||||
server {
|
||||
listen 3001;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:2080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:3456;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user