Skip to content

Add .env template support for Dockerfile templates#43

Merged
vbrunelle merged 3 commits intomainfrom
copilot/add-env-file-template
Dec 4, 2025
Merged

Add .env template support for Dockerfile templates#43
vbrunelle merged 3 commits intomainfrom
copilot/add-env-file-template

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 30, 2025

Description

Adds .env file templates paired with each Dockerfile template. Users can now edit environment variables on the same build creation page. The Django template includes DJANGO_ALLOWED_HOSTS as requested.

Changes:

  • Created 8 .env template files (Django.env, Flask.env, FastAPI.env, etc.) in builds/dockerfile_templates/
  • Added env_content field to Build model with migration
  • Added get_env_templates() and get_default_env_template() functions
  • New API endpoint: GET /builds/api/env-templates/<template_name>/
  • Updated build_create view and template to display .env editor
  • Modified execute_build() to write .env file during build
  • Both Dockerfile and .env content update when switching templates

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test addition/modification

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing
  • Test with real repositories

Test Configuration:

  • Python version: 3.12
  • Django version: 5.2.8
  • Operating System: Linux

Checklist

  • My code follows the style guidelines of this project (PEP 8, Black formatting)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Related Issues

Closes #42

Screenshots (if applicable)

Build create page with .env editor

Additional Notes

  • One pre-existing test failure (test_build_detail_shows_container_url) is unrelated to this change—it fails due to Docker not being available in the test environment causing sync_container_status() to modify the container state.
  • CodeQL security scan passed with no alerts.
Original prompt

This section details on the original issue you should resolve

<issue_title>Template de fichiers .env en complément des fichiers template Dockerfile</issue_title>
<issue_description>J'aimerais ajouter pour chaque fichier Dockerfile de template, un template de fichier .env, modifiable sur la même page que celle où on peut modifier le template.
La modification du fichier .env ne devrait affecter que le build en cours de création, de la même manière que de modifier le Dockerfile n'affecte que le build en cours.

Pour le template de Django, il serait important d'ajouter les allowed hosts. </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 30, 2025 22:00
Co-authored-by: vbrunelle <27235114+vbrunelle@users.noreply.github.com>
Co-authored-by: vbrunelle <27235114+vbrunelle@users.noreply.github.com>
Copilot AI changed the title [WIP] Add .env file template for Dockerfile Add .env template support for Dockerfile templates Nov 30, 2025
Copilot AI requested a review from vbrunelle November 30, 2025 22:08
@vbrunelle vbrunelle marked this pull request as ready for review December 1, 2025 04:14
@vbrunelle vbrunelle merged commit 8a4d9e5 into main Dec 4, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template de fichiers .env en complément des fichiers template Dockerfile

2 participants