Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
docker and version
Browse files Browse the repository at this point in the history
  • Loading branch information
maksii committed Aug 28, 2024
1 parent 48abef5 commit a638a76
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ RUN chown -R appuser:appgroup /UTOPIA-Upload-Assistant
# Switch to the non-root user
USER appuser

ENTRYPOINT ["python3", "/UTOPIA-Upload-Assistant/upload.py"]
CMD ["sh"]
2 changes: 1 addition & 1 deletion src/utils/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '20240828064100'
__version__ = '20240827132009'
20 changes: 19 additions & 1 deletion upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import platform
import shutil
import glob
from datetime import datetime
from datetime import datetime, timezone

from src.console import console
from rich.markdown import Markdown
Expand Down Expand Up @@ -53,6 +53,24 @@ def check_new_version():
response = requests.get(repo_url)
response.raise_for_status() # Raise an error for bad responses
latest_release = response.json()

# Check if running from a frozen executable
if getattr(sys, 'frozen', False):
release_date_str = latest_release['published_at']
release_date = datetime.strptime(release_date_str, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)
current_time = datetime.now(timezone.utc)
days_since_release = (current_time - release_date).days
content = (
"[bold magenta]Welcome to UTOPIA-Upload-Assistant![/bold magenta]\n\n"
"It looks like you're running this tool from a console or docker.\n"
f"The latest release was {days_since_release} days ago.\n"
"To ensure you're using the latest features and improvements, please check the latest commits or Docker image manually.\n\n"
"[bold cyan]Visit our repository:[/bold cyan] [link=https://github.com/maksii/UTOPIA-Upload-Assistant]GitHub Repository[/link]\n"
"[bold cyan]Check Docker images:[/bold cyan] [link=https://hub.docker.com/r/maksii/utopia-upload-assistant]Docker Hub[/link]"
)
panel = Panel(content, title="[bold magenta]Greetings![/bold magenta]", border_style="magenta")
console.print(panel)
return

latest_version = latest_release['tag_name']

Expand Down

0 comments on commit a638a76

Please sign in to comment.