Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 48f4423986 | |||
| 460b13c195 | |||
| b77e1ce605 | |||
| c8920df87e | |||
| eceb5da520 |
@@ -1,5 +1,5 @@
|
||||
# Stage 1: Build the Go application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -13,7 +13,7 @@ COPY . .
|
||||
# Build the application
|
||||
# CGO_ENABLED=0 is important for a clean static build for Alpine
|
||||
# -o main specifies the output file name
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
|
||||
RUN go build -o main .
|
||||
|
||||
# Stage 2: Create the final lightweight image
|
||||
FROM alpine:latest
|
||||
|
||||
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal 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
|
||||
|
||||
@@ -26,7 +26,7 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 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'.
|
||||
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 80
|
||||
|
||||
@@ -13,4 +13,17 @@ server {
|
||||
# This is the key for making client-side routing work.
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"private": true,
|
||||
"packageManager": "npm@11.6.2",
|
||||
"dependencies": {
|
||||
"@angular/animations": "^21.1.0",
|
||||
"@angular/cdk": "~21.1.2",
|
||||
"@angular/common": "^21.1.0",
|
||||
"@angular/compiler": "^21.1.0",
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Item } from '../models/item';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ApiService {
|
||||
private apiUrl = 'http://localhost:8080/api/items';
|
||||
private apiUrl = '/api/items';
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user