메인 콘텐츠로 건너뛰기

신택스 하이라이트 지원 추가

요약

신택스 하이라이트에 bash, dockerfile, yaml 를 추가했습니다.

테스트

bash 명령어

#!/bin/bash

# 변수 선언
NAME="Tilnote"
VERSION="2.0"

# 조건문
if [ -d "/var/log" ]; then
    echo "Log directory exists"
fi

# 반복문
for file in *.txt; do
    echo "Processing $file"
done

# 함수
function deploy() {
    npm run build
    pm2 restart all
}

# 파이프와 리다이렉션
cat file.txt | grep "error" > errors.log

dockerfile

  # Node.js 베이스 이미지
  FROM node:18-alpine

  # 작업 디렉토리 설정
  WORKDIR /app

  # 의존성 파일 복사
  COPY package*.json ./

  # 의존성 설치
  RUN npm ci --only=production

  # 앱 소스 복사
  COPY . .

  # 포트 노출
  EXPOSE 3000

  # 환경 변수
  ENV NODE_ENV=production

  # 앱 실행
  CMD ["node", "server.js"]

yaml

# Docker Compose 설정
version: '3.8'

services:
  frontend:
    build: ./front
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - API_URL=http://backend:9000
    depends_on:
      - backend

  backend:
    build: ./server
    ports:
      - "9000:9000"
    environment:
      -
MONGODB_URI=mongodb://mongo:27017/tilnote
      - JWT_SECRET=${JWT_SECRET}
    volumes:
      - ./uploads:/app/uploads

  mongo:
    image: mongo:latest
    volumes:
      - mongo-data:/data/db

volumes:
  mongo-data: