9 Commits

Author SHA1 Message Date
0112b35eee test
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 6s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 15s
2026-01-31 01:42:18 +01:00
7b90cac1d1 fix: path
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 7s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 14s
2026-01-31 01:38:56 +01:00
894a6f01c2 fix: add gcc
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 1m4s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 6s
2026-01-31 01:32:32 +01:00
9896850b49 fix: force CGO
Some checks failed
Build and Push Docker Images / build-and-push-backend (push) Failing after 13s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 8s
2026-01-31 01:30:43 +01:00
48f4423986 fix: Dockerfile cgo
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 16s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 7s
2026-01-31 01:21:43 +01:00
460b13c195 Changed to proxy
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 8s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 15s
2026-01-31 01:16:48 +01:00
b77e1ce605 Docker Compose 2026-01-31 01:03:36 +01:00
c8920df87e Update Docker
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 7s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 17s
2026-01-31 00:54:10 +01:00
eceb5da520 Update Docker and package
Some checks failed
Build and Push Docker Images / build-and-push-backend (push) Successful in 23s
Build and Push Docker Images / build-and-push-frontend (push) Failing after 23s
2026-01-31 00:51:55 +01:00
6 changed files with 47 additions and 4 deletions

View File

@@ -1,10 +1,14 @@
# Stage 1: Build the Go application # Stage 1: Build the Go application
FROM golang:1.22-alpine AS builder FROM golang:1.25-alpine AS builder
WORKDIR /app WORKDIR /app
# Copy go.mod and go.sum files to download dependencies # Copy go.mod and go.sum files to download dependencies
COPY go.mod go.sum ./ COPY go.mod go.sum ./
# Install the C compiler (gcc) and other build tools needed for CGO
RUN apk add --no-cache build-base
RUN go mod download RUN go mod download
# Copy the rest of the application source code # Copy the rest of the application source code
@@ -13,7 +17,7 @@ COPY . .
# Build the application # Build the application
# CGO_ENABLED=0 is important for a clean static build for Alpine # CGO_ENABLED=0 is important for a clean static build for Alpine
# -o main specifies the output file name # -o main specifies the output file name
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . RUN CGO_ENABLED=1 go build -o main .
# Stage 2: Create the final lightweight image # Stage 2: Create the final lightweight image
FROM alpine:latest FROM alpine:latest

19
docker-compose.yml Normal file
View File

@@ -0,0 +1,19 @@
services:
backend:
image: git.out.jafre.li/jafreli/dashboard-backend:latest
container_name: dashboard-backend
# ports:
# - "8080:8080"
restart: unless-stopped
volumes:
- ./data/dashboard.db:/root/dashboard.db
frontend:
image: git.out.jafre.li/jafreli/dashboard-frontend:latest
container_name: dashboard-frontend
ports:
- "80:80"
restart: unless-stopped
depends_on:
- backend

View File

@@ -15,6 +15,9 @@ COPY . .
# The output will be in the /app/dist/ directory # The output will be in the /app/dist/ directory
RUN npm run build RUN npm run build
# Debugging: List the contents of the build output directory
RUN ls -laR /app/dist/frontend
# Stage 2: Serve the application with Nginx # Stage 2: Serve the application with Nginx
FROM nginx:alpine FROM nginx:alpine
@@ -24,9 +27,12 @@ RUN rm /etc/nginx/conf.d/default.conf
# Copy the custom Nginx configuration from the local machine # Copy the custom Nginx configuration from the local machine
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
# Remove default Nginx welcome page
RUN rm -rf /usr/share/nginx/html/*
# Copy the built application from the builder stage to Nginx's web root directory # Copy the built application from the builder stage to Nginx's web root directory
# I am assuming the project name is 'dashboard'. If not, you may need to change the path 'dist/dashboard/browser'. # I am assuming the project name is 'dashboard'. If not, you may need to change the path 'dist/dashboard/browser'.
COPY --from=builder /app/dist/dashboard/browser /usr/share/nginx/html COPY --from=builder /app/dist/frontend/ /usr/share/nginx/html
# Expose port 80 for the web server # Expose port 80 for the web server
EXPOSE 80 EXPOSE 80

View File

@@ -13,4 +13,17 @@ server {
# This is the key for making client-side routing work. # This is the key for making client-side routing work.
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
# Add a new location block to proxy API requests
location /api/ {
# Forward the request to the backend service.
# The name 'backend' is resolved by Docker's internal DNS.
proxy_pass http://backend:8080;
# Set headers to pass along client information to the backend
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
} }

View File

@@ -23,6 +23,7 @@
"private": true, "private": true,
"packageManager": "npm@11.6.2", "packageManager": "npm@11.6.2",
"dependencies": { "dependencies": {
"@angular/animations": "^21.1.0",
"@angular/cdk": "~21.1.2", "@angular/cdk": "~21.1.2",
"@angular/common": "^21.1.0", "@angular/common": "^21.1.0",
"@angular/compiler": "^21.1.0", "@angular/compiler": "^21.1.0",

View File

@@ -7,7 +7,7 @@ import { Item } from '../models/item';
providedIn: 'root' providedIn: 'root'
}) })
export class ApiService { export class ApiService {
private apiUrl = 'http://localhost:8080/api/items'; private apiUrl = '/api/items';
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }