-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|