Skip to content

Conversation

@Nishim12
Copy link
Contributor

This pull request updates the deployment workflow and Docker Compose configuration to allow for more flexible versioning and deployment of backend and frontend services. The main improvements are the introduction of customizable version tags for both backend and frontend images, and the ability to skip backend builds during deployment.

Workflow and deployment improvements:

  • Renamed the workflow dispatch input from skip_build to skip_backend_build for clarity, and updated all related workflow logic to use the new name. [1] [2]
  • Added new workflow dispatch inputs: frontend_version and backend_version, allowing users to specify which tags of the frontend and backend images to deploy. Defaults to 'latest' if not provided.
  • Added a new workflow step to dynamically set the backend and frontend Docker image tags in docker-compose.yml based on workflow inputs or the current Git reference.

Configuration changes:

  • Updated docker-compose.yml to use the BACKEND_TAG and FRONTEND_TAG environment variables for the backend and frontend image tags, instead of hardcoding 'latest'. [1] [2]… do docker stack deploy

@Nishim12 Nishim12 requested a review from Copilot August 26, 2025 19:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances the deployment workflow to support versioned Docker image deployments with configurable backend and frontend tags. The changes enable more precise control over which versions of services are deployed while maintaining backward compatibility.

  • Added configurable version inputs for backend and frontend Docker images
  • Renamed skip_build to skip_backend_build for improved clarity
  • Implemented dynamic tag substitution in docker-compose.yml based on workflow inputs

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/deploy-production.yml Added version inputs, renamed skip_build parameter, and implemented dynamic tag setting logic
docker-compose.yml Updated image tags to use environment variables instead of hardcoded 'latest'

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +140 to +141
sed -i "s/\${BACKEND_TAG}/$BACKEND_TAG/g" docker-compose.yml
sed -i "s/\${FRONTEND_TAG}/$FRONTEND_TAG/g" docker-compose.yml
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sed with variable substitution without proper escaping can lead to command injection if the tag variables contain special characters. Consider using a more secure approach like envsubst or proper shell escaping.

Suggested change
sed -i "s/\${BACKEND_TAG}/$BACKEND_TAG/g" docker-compose.yml
sed -i "s/\${FRONTEND_TAG}/$FRONTEND_TAG/g" docker-compose.yml
export BACKEND_TAG FRONTEND_TAG
envsubst '${BACKEND_TAG},${FRONTEND_TAG}' < docker-compose.yml > docker-compose.yml.tmp
mv docker-compose.yml.tmp docker-compose.yml

Copilot uses AI. Check for mistakes.
Comment on lines +140 to +141
sed -i "s/\${BACKEND_TAG}/$BACKEND_TAG/g" docker-compose.yml
sed -i "s/\${FRONTEND_TAG}/$FRONTEND_TAG/g" docker-compose.yml
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sed with variable substitution without proper escaping can lead to command injection if the tag variables contain special characters. Consider using a more secure approach like envsubst or proper shell escaping.

Suggested change
sed -i "s/\${BACKEND_TAG}/$BACKEND_TAG/g" docker-compose.yml
sed -i "s/\${FRONTEND_TAG}/$FRONTEND_TAG/g" docker-compose.yml
export BACKEND_TAG FRONTEND_TAG
envsubst '${BACKEND_TAG},${FRONTEND_TAG}' < docker-compose.yml > docker-compose.yml.subst
mv docker-compose.yml.subst docker-compose.yml

Copilot uses AI. Check for mistakes.
run: |
# Backend tag
if [ "${{ github.event.inputs.skip_backend_build }}" == "true" ]; then
BACKEND_TAG="${{ github.event.inputs.backend_version || 'latest' }}"
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback to 'latest' may not work as expected when backend_version is an empty string rather than null. Consider using a more explicit check or defaulting in the workflow input definition.

Suggested change
BACKEND_TAG="${{ github.event.inputs.backend_version || 'latest' }}"
BACKEND_TAG="${{ github.event.inputs.backend_version != '' && github.event.inputs.backend_version || 'latest' }}"

Copilot uses AI. Check for mistakes.
@Nishim12 Nishim12 merged commit a0dcd66 into main Aug 26, 2025
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.

2 participants