Skip to content

Conversation

@tmck-code
Copy link
Owner

@tmck-code tmck-code commented Dec 4, 2025

Context

This PR moves the pokesprite repository and cowfile generation out of the Dockerfile to a git submodule and build script, which significantly improves the speed and error handling of the cowfile generation process.

Changes

Cowfiles build in parallel outside Dockerfile

  • Move cowfile building out of dockerfile
    • Reduces Docker image size by not embedding pokesprite files directly
  • Use the submodule directory instead of cloning at build time
    • Allows version control of the pokesprite dependency
  • Alter the makefile task to use the new build_cowfiles.sh script

Improved error handling, Better file management and user permissions

  • Improved error handling with explicit failure logging
  • Deduplicates cowfiles using a set-based approach instead of linear search
  • Track conversion failures and display them in debug mode
  • Don't overwrite original pokesprite files
    • Use a tmp directory for intermediate files during conversion
    • Prevents pollution of the original pokesprite submodule
  • Better user permissions
    • Use user u instead of root for better security
    • Remove all use of root user in local build scripts
    • Update other makefile tasks

Updated github workflow

  • Build cows as a separate step
  • Ensure pokesprite submodule is available during build

stage time before time after
cowfile gen 47s 4s
all 2m14s 1m32s

- it causes the image to be pretty big
- can use the submodule dir instead
- alter the makefile task to use the new script
- use 1 worker per core
- add better error detection and logging for conversions
- use user u instead of root
- build cows
- mount cows when building assets
@tmck-code tmck-code added performance Related to speed/resource usage code quality Good for dev, little/no impact to users distribution labels Dec 4, 2025
@tmck-code tmck-code merged commit d1a6b6d into master Dec 4, 2025
1 check passed
@tmck-code tmck-code deleted the pokesay-submodule branch December 4, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Good for dev, little/no impact to users distribution performance Related to speed/resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants