SecuAAS Docs

Compilation and Build

SecuFile — Compilation and Build

Compilation and Build

Compilation and Build

Prerequisites

Go Backend (filesecure)

  • Go 1.25 or higher
  • PostgreSQL 15+
  • Redis 7+
  • Docker (for production builds)
  • Access to the Harbor OVH registry (qq9o8vqe.c1.bhs5.container-registry.ovh.net)

WebGUI (filesecure-webgui)

  • Node.js 20+ LTS
  • npm 10+
  • Python 3.11+
  • Docker (for production builds)

Building the Go Backend

Local Build

cd /home/ubuntu/projects/filesecure/backend

# Download dependencies and clean
go mod tidy

# Compile the API binary
go build -o bin/api ./cmd/api/

# Compile the S3 cleanup tool
go build -o bin/cleanup-s3 ./cmd/cleanup-s3/

# Compile the RSA key initialization tool
go build -o bin/init-keys ./cmd/init-keys/

Using the Makefile

cd /home/ubuntu/projects/filesecure

# Build the binary
make build

# Run tests (16 test suites)
make test

# Run tests with coverage report
make test-coverage

# Run linter (golangci-lint)
make lint

# Clean build artifacts
make clean

Code Verification

cd /home/ubuntu/projects/filesecure/backend

# Static analysis
go vet ./...

# Run all tests (16 test suites)
go test ./...

# Full build with no errors
go build ./cmd/api/

Docker Build

The Dockerfile uses a multi-stage build to minimize image size:

# Stage 1: Build
FROM golang:1.25-alpine AS builder
RUN apk add --no-cache git ca-certificates tzdata
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo \
    -ldflags="-w -s" -o /filesecure-api ./cmd/api

# Stage 2: Runtime
FROM alpine:3.19
RUN apk --no-cache add ca-certificates tzdata postgresql-client
WORKDIR /app
COPY --from=builder /filesecure-api .
COPY --from=builder /app/migrations ./migrations
COPY docker-entrypoint.sh .
RUN chmod +x docker-entrypoint.sh
RUN adduser -D -g '' appuser
USER appuser
EXPOSE 8080
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["./filesecure-api"]

Build via SecuOps

# Build the Docker image via SecuOps
secuops build --app=secufile-backend --env=k8s-dev

# The image is automatically tagged and pushed to Harbor
# Format: qq9o8vqe.c1.bhs5.container-registry.ovh.net/secuops/secufile-backend-backend:main-XXXXXX

Building the React Frontend

Local Build

cd /home/ubuntu/projects/filesecure-webgui/frontend

# Install dependencies
npm install

# Production build
npm run build

# The build generates a bundle of approximately 530 kB

Docker Build

# Build via SecuOps (frontend + Python backend)
secuops build --app=filesecure-webgui --env=k8s-dev

# Two images are generated:
# - secuops/secufile-webgui-frontend:main-XXXXXX (nginx + React)
# - secuops/secufile-webgui-backend:main-XXXXXX (Python FastAPI)

Installing the Python Backend

cd /home/ubuntu/projects/filesecure-webgui/backend

# Create a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run in development mode
uvicorn server:app --host 0.0.0.0 --port 8001 --reload

On this page