diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..355ff9f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM oven/bun:1.0.25-slim as builder +WORKDIR /app + +# Copy package files +COPY package*.json ./ +COPY bun.lockb ./ + +# Install dependencies +RUN bun install + +# Copy source files +COPY . . + +# Build the application +RUN bun run build + +# Production stage +FROM nginx:alpine +COPY --from=builder /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..c01ed4f --- /dev/null +++ b/deploy.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +# Build the application +echo "Building the application..." +bun run build + +# Get the tag or use latest +TAG=$(git describe --tags --exact-match 2>/dev/null || echo "latest") +echo "Building docker image with tag: $TAG" + +# Build and push the Docker image +docker build -t docker.site.quack-lab.dev/signaturer:$TAG . +docker push docker.site.quack-lab.dev/signaturer:$TAG + +echo "Deployment completed successfully!" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b8a3927 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.8' + +services: + app: + image: docker.site.quack-lab.dev/signaturer:latest + ports: + - "80:80" + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:80"] + interval: 30s + timeout: 10s + retries: 3 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..6813ef7 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Support for Single Page Application routing + location / { + try_files $uri $uri/ /index.html; + } + + # Cache static assets + location /assets { + expires 1y; + add_header Cache-Control "public, no-transform"; + } +} \ No newline at end of file