[新服务] Docker自建基于浏览器的rename工具
date
Dec 28, 2023
slug
newservice-docker-rename-web
status
Published
summary
新服务-
tags
service
type
Post
URL
Summary
- ‣
- 主要是vue packages的build
步骤
export DOCKER_PROJ=rename
export DOCKER_PROJ_DOMAIN=$DOCKER_PROJ.riyu.org
mkdir -p /data/$DOCKER_PROJ/; cd /data/$DOCKER_PROJ
git clone https://github.com/JasonGrass/rename.git html
cat > Dockerfile <<EOF
# Stage 1: Build the application
FROM node:latest as build-stage
WORKDIR /app
# Assuming your package.json is located in html/
COPY html/package*.json ./
RUN npm install
COPY html/ .
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:alpine
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
EOF
cat > nginx.conf <<EOF
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
}
EOF
cat > docker-compose.yml <<EOF
version: '3'
services:
rename:
build: .
container_name: rename
restart: always
networks:
default:
name: npm_nginx_proxy_manager-network
external: true
EOF
docker-compose down; docker-compose up -d --build; sleep 1s; docker-compose logs -f