네이버 블로그 포스팅 선택사항으로 고쳐서 도커 ì파일 ã… 수정

This commit is contained in:
sunmingLee 2025-10-30 20:30:44 +09:00
parent 4bc7f87663
commit efcec065ec
4 changed files with 46 additions and 5 deletions

View File

@ -1,15 +1,40 @@
# Multi-stage build for Spring Boot application
FROM eclipse-temurin:21-jre-alpine AS builder
FROM eclipse-temurin:21-jre AS builder
WORKDIR /app
COPY build/libs/*.jar app.jar
RUN java -Djarmode=layertools -jar app.jar extract
FROM eclipse-temurin:21-jre-alpine
FROM eclipse-temurin:21-jre
WORKDIR /app
# Create non-root user
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
# Install Playwright essential dependencies only
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libdbus-1-3 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound2t64 \
libpango-1.0-0 \
libcairo2 \
libatspi2.0-0 \
libxshmfence1 \
fonts-liberation \
libappindicator3-1 \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*
# Create browser installation directory with proper permissions
RUN mkdir -p /app/playwright && chmod 777 /app/playwright
# Copy layers from builder
COPY --from=builder /app/dependencies/ ./
@ -17,6 +42,17 @@ COPY --from=builder /app/spring-boot-loader/ ./
COPY --from=builder /app/snapshot-dependencies/ ./
COPY --from=builder /app/application/ ./
# Set Playwright browsers path
ENV PLAYWRIGHT_BROWSERS_PATH=/app/playwright
# Create non-root user
RUN groupadd -r spring && useradd -r -g spring spring
# Change ownership to spring user
RUN chown -R spring:spring /app
USER spring:spring
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8085/distribution/actuator/health || exit 1

View File

@ -6,6 +6,7 @@ import com.kt.distribution.dto.ChannelType;
import com.kt.distribution.dto.DistributionRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -20,6 +21,7 @@ import java.util.UUID;
@Slf4j
@Component
@RequiredArgsConstructor
@ConditionalOnProperty(name = "naver.blog.enabled", havingValue = "true", matchIfMissing = false)
public class NaverAdapter extends AbstractChannelAdapter {
private final NaverBlogClient naverBlogClient;

View File

@ -5,6 +5,7 @@ import com.microsoft.playwright.*;
import com.microsoft.playwright.options.LoadState;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import jakarta.annotation.PostConstruct;
@ -23,6 +24,7 @@ import java.nio.file.Paths;
*/
@Slf4j
@Component
@ConditionalOnProperty(name = "naver.blog.enabled", havingValue = "true", matchIfMissing = false)
public class NaverBlogClient {
@Value("${naver.blog.username:}")

View File

@ -126,6 +126,7 @@ channel:
# Naver Blog Configuration (Playwright 기반)
naver:
blog:
enabled: ${NAVER_BLOG_ENABLED:false}
username: ${NAVER_BLOG_USERNAME:}
password: ${NAVER_BLOG_PASSWORD:}
blog-id: ${NAVER_BLOG_ID:}