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

Add a new docker-compose service for our Next.js frontend application #80

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

jhodapp
Copy link
Member

@jhodapp jhodapp commented Dec 3, 2024

Description

This PR adds a new docker-compose service for building/running our Next.js frontend application as a container. docker-compose build && docker-compose up will now start a complete application in 3 different containers.

GitHub Issue: #61

Changes

  • Add a new service to docker-compose.yaml that defines the Next.js frontend application
  • Can build a frontend image
  • Can start a frontend container
  • All 3 services run as a complete platform system

Testing Strategy

  1. docker-compose build
  2. docker-compose up
  3. Visit http://localhost:3000/login and verify that the page loads
  4. Try logging in and observe in the docker runtime log that the frontend tries to authenticate a non-existent user with the backend and fails

Context

I used the follow .env file to build the complete containerized system:

# PostgreSQL environment variables for local development
POSTGRES_USER=refactor  # Default PostgreSQL user for local development
POSTGRES_PASSWORD=password  # Default PostgreSQL password for local development
POSTGRES_DB=refactor  # Default PostgreSQL database for local development
POSTGRES_HOST=postgres  # The local Docker Compose PostgreSQL container hostname
POSTGRES_PORT=5432  # PostgreSQL default port for local development
POSTGRES_SCHEMA=refactor_platform  # PostgreSQL schema for the application
# Database connection URL for the Rust application
DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
# Rust application environment variables
SERVICE_INTERFACE=0.0.0.0
SERVICE_PORT=4000
NEXTJS_FRONTEND_PORT=3000

# App user configuration
USERNAME=appuser  # Username for the non-root user in the container
USER_UID=1000  # User ID for the appuser
USER_GID=1000  # Group ID for the appuser

Concerns

None

…n. docker-compose build && docker-compose up will now start a complete application in 3 different containers
@jhodapp jhodapp added enhancement Improves existing functionality or feature feature work Specifically implementing a new feature labels Dec 3, 2024
@jhodapp jhodapp self-assigned this Dec 3, 2024
@jhodapp jhodapp changed the title Adds a new docker-compose service for our Next.js frontend application Add a new docker-compose service for our Next.js frontend application Dec 3, 2024
@jhodapp jhodapp merged commit 3f446be into main Dec 4, 2024
4 checks passed
@jhodapp jhodapp deleted the add_frontend_container_to_docker_compose_config branch December 4, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing functionality or feature feature work Specifically implementing a new feature
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants