Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use upstream base image #44

Merged
merged 24 commits into from
Jul 26, 2024
Merged

Use upstream base image #44

merged 24 commits into from
Jul 26, 2024

Conversation

KTanAug21
Copy link
Contributor

@KTanAug21 KTanAug21 commented Jul 21, 2024

Discussion: See discourse post.

TLDR: we're porting the fly-apps/laravel-docker functionality over to this package, so that this package may create a Dockerfile that does not use the custom image built by that repository, but uses an upstream image instead.


WHAT AND WHY
Revise Dockerfile template to create a Dockerfile that uses an upstream base image. There are three reasons for this:

  1. To remove the scope of having to maintain the custom image( fideloper/fly-laravel ) built from the fly-apps/laravel-docker repository for SOC2 compliance, which we currently cannot fully commit to.
  2. Consistency: The generated Dockerfiles for other frameworks like Rails, Elixir, Javascript, all use upstream images as base. For consistency, we should also follow for the Dockerfile generated for Laravel apps.
  3. Finally, this move will result in depositing server config files to the users' project directory where they can visibly and readily find them, providing them full control over these files.

HOW
Well super easy! fly-apps/laravel-docker actually uses an upstream image as base, so we can simply merge the Dockerfile's logic it creates with our existing Dockerfile's logic, along with the necessary config files used by that Dockerfile to dockerfile-laravel.


How To Review
Ok! There're a lot of files right? lots.
The easiest way to review this PR would be to see if it works for a local Laravel app one might have:

  1. Get the PR locally
  2. Run pwd---this should get the directory where the local dockerfile-laravel can be retrieved from
  3. CD into a Laravel project
  4. run: php <path\to\dockerfile-laravel-project>\dockerfile-laravel generate --upstream-base-image
  5. Once done! Please update the .dockerignore to remove .env from files to ignore, since we need it for a local image
  6. Please build the Dockerfile with docker build -t my_sample_app .
  7. Run the image as container: docker run -p 8080:8080 my_sample_app

Hopefully everything works out well!

Lastly if you really wanna be thorough, here are the important files that got them changes:

Primary Logic

  1. app/Services/Scanner.php - adds the necessary files into templates to render
  2. resources/views/dockerfile.blade.php - revised to use laravel-docker's Dockerfile statements, and merge it with previous Dockerfile statements. This results in a Dockerfile that makes use of upstream image

Additional Templates
There're a lot of these.
resources/views/fly - should contain subdirectories and files that are templates to be rendered into the user's .fly directory

The Tests
These are not quite essential. but. essential, too at the same time! Feel free to check one by one.

Kathryn Anne S Tan added 18 commits July 18, 2024 23:54
…octane flavor is dtected/selected, temporarily use a flag to generate the upstream file
…ic from the repository maintaining its previous custom image
…sh when generating files for upstream based docker image
@KTanAug21 KTanAug21 merged commit d2fabba into main Jul 26, 2024
2 checks passed
@KTanAug21 KTanAug21 deleted the use_upstream_base_image branch July 26, 2024 20:08
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.

Use an Upstream base image
1 participant