Skip to content

Workflow is not loading my environment #136278

Answered by davidh16
davidh16 asked this question in Actions
Discussion options

You must be logged in to vote

Hey I have found the solution in the meantime. The issue is that loading environment is not enough. I solved my problem by creating .env file in the workflow and filling it with variables from environment, then upon building an image, workflow bakes variables into my application.

To explain a bit more,
there is a line in my Dockerfile

COPY . .

this ensures that created .env file in workflow is copied in docker image.

Vite works in a way that environment variables are accessible only if they are baked in application during build.
Here is my workflow code thats makes sure .env is created properly

 - name: Prepare Environment Variables for Deployment
        id: prepare-env
        run: |
  …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
1 reply
@davidh16
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@davidh16
Comment options

Answer selected by davidh16
@broguinn
Comment options

@davidh16
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
3 participants