Skip to main content

Deployment of the Northwind Application (bcackend and frontend)

Backend Deployment​

There are many options for hosting the backend API. Let's pick Azure App Service for this project, specifically containerized deployment.

Containerization with Docker​

  1. Create a Dockerfile in the root of your backend project.
# Use an official Go runtime as a parent image
FROM golang:1.20-alpine
# Set the working directory inside the container
WORKDIR /app
# Copy the Go module files and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the application code
COPY . .
# Build the Go application
RUN go build -o main .
# Expose the port the app runs on
EXPOSE 8080
# Command to run the application
CMD ["./main"]
  1. Build the Docker image: docker build -t northwind-backend .
  2. Run the container locally to test: docker run -p 8080:8080 northwind-backend
  3. Push the Docker image to a container registry (e.g., Docker Hub, Azure Container Registry).
  4. Create a new Azure App Service instance and configure it to use the container image from your registry.
  5. Set up environment variables for database connection strings and other configurations in Azure App Service.

Frontend Deployment​

Azure Static Web Apps fits the bill.

Steps to deploy the frontend:​

  1. Build the React app for production: npm run build
  2. Create a new Static Web App in Azure Portal, linking it to your GitHub repository.
  3. Configure the build settings to point to the build directory.
  4. Set up environment variables for the API endpoint in Azure Static Web Apps.
  5. Deploy and verify the frontend is working and can communicate with the backend API.