diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9b31c96 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +.gitignore +.gitmodules +.hugo_build.lock +public/ +resources/ +.DS_Store +*.log +README.md +Dockerfile +.dockerignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..17e6110 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Build stage +FROM golang:1.21-alpine AS builder + +# Install Hugo and Git +RUN apk add --no-cache hugo git + +# Set working directory +WORKDIR /app + +# Copy the repository contents +COPY . . + +# Build the site +RUN hugo --minify + +# Production stage +FROM nginx:alpine + +# Copy the built site from builder +COPY --from=builder /app/public /usr/share/nginx/html + +# Copy custom nginx config if needed +# COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Expose port 80 +EXPOSE 80 + +# Start nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1be37d7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +name: karsttech-website + +services: + hugo-site: + build: + context: . + dockerfile: Dockerfile + image: karsttech:1 + container_name: karsttech-website + restart: unless-stopped + ports: + - "8317:80" \ No newline at end of file