반응형

golang을 최소 설치를 했더니 귀찮다.

FROM golang:alpine

WORKDIR /app

COPY . ./

RUN go mod download
RUN go mod tidy
RUN go build -o main .

# TimeZone 설정
RUN apk --no-cache add tzdata && \
    cp /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
    echo "Asia/Seoul" > /etc/timezone \
    apk del tzdata

CMD ["./main", "1"]
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /App

# Copy everything
COPY . ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out


# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /App
COPY --from=build-env /App/out .

# TimeZone 설정
ENV TZ Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone


ENTRYPOINT ["dotnet", "AnomalyDetection.dll"]
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /App

# Copy everything
COPY . ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /App
COPY --from=build-env /App/out .

# TimeZone 설정
ENV TZ Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone


ENTRYPOINT ["dotnet", "Aru.dll"]
version: '3.3'
services:
  aru_collector:
    image: 'aru_collector'
    volumes:
    - /mnt/d/Data/Aru:/var/pos
    - /mnt/d/ML/Data:/var/data    
    - /mnt/d/data/AruTrigger:/var/trigger    
    environment:
      ENVIRONMENT: linux
    links:
    - "PostgreSQL"
  aru_anomaly_detection:
    image: 'aru_anomaly_detection'
    volumes:
    - /mnt/d/ML/Data:/var/data    
    - /mnt/d/data/AruTrigger:/var/trigger    
    environment:
      ENVIRONMENT: linux
    links:
    - "PostgreSQL"  
  aru:
    image: 'aru'
    volumes:
    - /mnt/d/ML/Data:/var/data    
    - /mnt/d/data/AruTrigger:/var/trigger    
    environment:
      ENVIRONMENT: linux
    network_mode: "host"
  PostgreSQL:
    image: postgres
    environment:
      POSTGRES_PASSWORD: "test"          
    ports:
    - 5432:5432
    volumes:
    - /home/postgreSQL:/var/lib/postgresql/data
    shm_size: 1g

'프로그래밍' 카테고리의 다른 글

docker network mode  (0) 2022.12.06
Postgresql Last Insert Id 얻기  (0) 2022.12.01
golang docker 말기  (0) 2022.11.24
golang 공유 자원 사용하기  (0) 2022.11.03
golang 간단한 pg 라이브러리  (0) 2022.11.02

+ Recent posts