Skip to content

Conversation

tiagorvmartins
Copy link

As I have commented 7 days ago and didn't found a proposal from the repository owner to the request, took the time today to do it myself. Now willing to share with others following the creation of this pull request.

Also updated README.md with details to build and execute the production image, without needing to clone the repo, adding those here as well.

An initial image (tiagorvmartins/wapy.dev) has been built and pushed to docker hub such that others can start spinning up and use it.

Production App Settings

Docker image

To build the production docker image use the following commannd:

docker build -t wapy.dev -f Dockerfile .

Compose

Replace production environment file with your settings

  1. Run the following command to get VAPID public and private keys:

    npx --yes web-push generate-vapid-keys --json
    
  2. Replace them accordingly on the .env.production

    NEXT_PUBLIC_VAPID_PUBLIC_KEY=<publicKey_from_command_above>
    VAPID_PRIVATE_KEY=<privateKey_from_command_above>
    
  3. Choose/create the secret keys for the following environment variables

    POSTGRES_PASSWORD
    AUTH_SECRET
    SUBSCRIPTION_JWT_SECRET
    
  4. Replace your RESEND_API_KEY

    RESEND_API_KEY=<your_resend_api_key>
    
  5. Configure your domain on your RESEND account and adapt the following env vars

    RESEND_FROM=no-reply@<your-domain>
    RESEND_CONTACT_EMAIL=contact@<your-domain>
    
  6. Configure SITE_URL environment with your domain

    SITE_URL=https://<your-domain>
    
  7. Optionally set the following env vars, for logging in with github and/or google.

    # Github
    GITHUB_ID=
    GITHUB_SECRET=
    
    # Google
    GOOGLE_ID=
    GOOGLE_SECRET=
    
  8. Execute the stack

    docker compose -f docker-compose.prod.yml up -d
    

@meceware
Copy link
Owner

Thanks for the PR. I created the Dockerfile and made other modifications inspired by your changes. The main repo is updated to get it working with docker images created automatically right now. Docker compose is updated accordingly for dev and prod builds, as well as many other minor changes. Can you check if everything is working? I'm gonna close this PR based on your response.

@tiagorvmartins
Copy link
Author

I didn't had opportunity to test yet, but took a glance at your commits and looks good to me, will test later when there are more updates and if something pops up will let you know.

Also as enhancement since you are touching this at the moment, you could create the docker images tagged by each release version you create here on github beside the latest tag.

Such that on ghcr there could be docker images tagged, for instance: ghcr.io/meceware/wapy.dev:v1.0.0.rc6 and so on.

Closing this PR now right now,
Also thank you for the kudos!

@meceware
Copy link
Owner

as enhancement since you are touching this at the moment, you could create the docker images tagged by each release version

Thanks for the suggestion, I think it should be tagged automatically when I start releasing the versions soon, but still needs to be tested. In any case, I will definitely tag the images based on release versions and fix the deployment script if necessary. I couldn't make it work with 1.0.0.rcX version style and didn't want to push many times trying :)

@tiagorvmartins tiagorvmartins deleted the feature/production-docker-image branch January 13, 2025 23:14
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