Skip to content

Commit

Permalink
20240306 update
Browse files Browse the repository at this point in the history
  • Loading branch information
neko0xff committed Mar 6, 2024
1 parent 213e5a8 commit ef74bcd
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Dockerfile.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 基於的映像檔
FROM alpine:latest

# 建立工作目錄
WORKDIR /usr/src/app

# 時區
ENV TZ=Asia/Taipei
RUN echo "${TZ}" > /etc/timezone
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime

# 安裝&更新所需的套件
RUN apk update
RUN apk upgrade --no-cache
RUN apk add --no-cache nodejs npm icu-data-full tzdata
RUN rm /var/cache/apk/*

# 把目錄下的程式碼直接復制到容器中
COPY package*.json ./
RUN npm install
COPY . .

# 指定使用的端口
EXPOSE 5000

# 容器啟動時
CMD [ "npm", "start" ]
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CC1:=docker compose
CC2:=pnpm
IMAGE:=telegram_bot1

.PHONY: build up logs stop clean pnpm-start

all: build

build:
@$(CC1) up --build -d

up:
@$(CC1) up -d

logs:
@$(CC1) logs --tail=100 -f

stop:
@$(CC1) stop

clean:
@$(CC1) down

pnpm-start:
@$(CC2) start
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'
services:
server:
container_name: telegram_bot1 # 自定義容器名稱
restart: always # 跟系統服務一起重啟
network_mode: host # 網路: 使用實體機
# 編譯時的設置
build:
context: .
dockerfile: Dockerfile.env

0 comments on commit ef74bcd

Please sign in to comment.