Skip to content

Commit

Permalink
remove Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ARC-MX committed Jan 5, 2025
1 parent 4e3202c commit dc65e8d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 75 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
version:
description: 'version of this branch'
default: 'v1.6.3'
default: 'v1.6.4'
required: true
type: string
paths:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
else
TAG_ARCH=$ARCH
fi
docker buildx build --build-arg VERSION=${VERSION} --platform linux/${ARCH} -t ${DOCKER_IMAGE}-${TAG_ARCH}:latest -t ${DOCKER_IMAGE}-${TAG_ARCH}:${VERSION} -t ${DOCKER_IMAGE}:latest-${ARCH} -t ${DOCKER_IMAGE}:${VERSION}-${ARCH} --file Dockerfile-for-github-action --push .
docker buildx build --build-arg VERSION=${VERSION} --platform linux/${ARCH} -t ${DOCKER_IMAGE}-${TAG_ARCH}:latest -t ${DOCKER_IMAGE}-${TAG_ARCH}:${VERSION} --file Dockerfile-for-github-action --push .
done
- name: Log into Aliyun hub registry and push Docker image
Expand All @@ -62,5 +62,5 @@ jobs:
else
TAG_ARCH=$ARCH
fi
docker buildx build --build-arg VERSION=${VERSION} --platform linux/${ARCH} -t ${DOCKER_IMAGE}-${TAG_ARCH}:latest -t ${DOCKER_IMAGE}-${TAG_ARCH}:${VERSION} -t ${DOCKER_IMAGE}:latest-${ARCH} -t ${DOCKER_IMAGE}:${VERSION}-${ARCH} --file Dockerfile-for-github-action --push .
docker buildx build --build-arg VERSION=${VERSION} --platform linux/${ARCH} -t ${DOCKER_IMAGE}-${TAG_ARCH}:latest -t ${DOCKER_IMAGE}-${TAG_ARCH}:${VERSION} --file Dockerfile-for-github-action --push .
done
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions build.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ host_network: true
startup: application
boot: auto
init: false
# image: "registry.cn-hangzhou.aliyuncs.com/arcw/sgcc_electricity-{arch}"
image: "registry.cn-hangzhou.aliyuncs.com/arcw/sgcc_electricity-{arch}"
map:
- config:rw
options:
Expand Down
46 changes: 0 additions & 46 deletions run.sh

This file was deleted.

29 changes: 17 additions & 12 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,12 @@
def main():
global RETRY_TIMES_LIMIT
if 'PYTHON_IN_DOCKER' not in os.environ:
logging.info(f"The current run is running as source code.")
# 读取 .env 文件
import dotenv
dotenv.load_dotenv(verbose=True)
try:
PHONE_NUMBER = os.getenv("PHONE_NUMBER")
PASSWORD = os.getenv("PASSWORD")
HASS_URL = os.getenv("HASS_URL")
JOB_START_TIME = os.getenv("JOB_START_TIME","07:00" )
LOG_LEVEL = os.getenv("LOG_LEVEL","INFO")
VERSION = os.getenv("VERSION")
RETRY_TIMES_LIMIT = int(os.getenv("RETRY_TIMES_LIMIT", 5))
except Exception as e:
logging.error(f"Failing to read the .env file, the program will exit with an error message: {e}.")
sys.exit()
else:
if os.path.isfile('/data/options.json'):
logging.info(f"当前以Homeassistant Add-on 形式运行.")
with open('/data/options.json') as f:
options = json.load(f)
try:
Expand All @@ -54,6 +45,20 @@ def main():
except Exception as e:
logging.error(f"Failing to read the options.json file, the program will exit with an error message: {e}.")
sys.exit()
else:
logging.info(f"The current run runs as a docker image.")
try:
PHONE_NUMBER = os.getenv("PHONE_NUMBER")
PASSWORD = os.getenv("PASSWORD")
HASS_URL = os.getenv("HASS_URL")
JOB_START_TIME = os.getenv("JOB_START_TIME","07:00" )
LOG_LEVEL = os.getenv("LOG_LEVEL","INFO")
VERSION = os.getenv("VERSION")
RETRY_TIMES_LIMIT = int(os.getenv("RETRY_TIMES_LIMIT", 5))
except Exception as e:
logging.error(f"Failing to read the .env file, the program will exit with an error message: {e}.")
sys.exit()

logger_init(LOG_LEVEL)
logging.info(f"The current repository version is {VERSION}, and the repository address is https://github.com/ARC-MX/sgcc_electricity_new.git")
current_datetime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
Expand Down

0 comments on commit dc65e8d

Please sign in to comment.