diff --git a/.github/workflows/docker-build-self.yml b/.github/workflows/docker-build-self.yml index 972b338..4d6db44 100644 --- a/.github/workflows/docker-build-self.yml +++ b/.github/workflows/docker-build-self.yml @@ -17,6 +17,19 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.24' + + - name: Install dependencies + run: | + go mod download + go mod tidy + - name: Build Go application + run: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./server ./src + - name: Build Docker image run: | docker build -t "$IMAGE_NAME:latest" -t "$IMAGE_NAME:${{ github.run_number }}" . diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index f82d2dc..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: '3.8' - -services: - knet: - build: . - ports: - - "54321:54321" - environment: - - API_TOKEN=${API_TOKEN:-your-default-token} - - API_USERNAME=${API_USERNAME:-api} - - BUILD_NUMBER=${BUILD_NUMBER:-dev} - networks: - - monitoring - - prometheus: - image: prom/prometheus:latest - container_name: knet-prometheus - ports: - - "9090:9090" - volumes: - - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro - - prometheus_data:/prometheus - command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.path=/prometheus' - - '--storage.tsdb.retention.time=30d' - - '--storage.tsdb.retention.size=10GB' - - '--web.console.libraries=/etc/prometheus/console_libraries' - - '--web.console.templates=/etc/prometheus/consoles' - - '--web.enable-lifecycle' - - '--web.enable-admin-api' - networks: - - monitoring - restart: unless-stopped - - grafana: - image: grafana/grafana:latest - container_name: knet-grafana - ports: - - "3000:3000" - environment: - - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin} - volumes: - - grafana_data:/var/lib/grafana - - ./grafana/provisioning:/etc/grafana/provisioning - networks: - - monitoring - restart: unless-stopped - depends_on: - - prometheus - -networks: - monitoring: - driver: bridge - -volumes: - prometheus_data: - grafana_data: diff --git a/dockerfile b/dockerfile index 503c1f7..045dada 100644 --- a/dockerfile +++ b/dockerfile @@ -1,29 +1,15 @@ -# Step 1: Build the Go binary in a separate stage -FROM golang:1.24 AS builder - -# Set the working directory -WORKDIR /app - -# Copy the Go module files -COPY go.mod go.sum ./ -RUN go mod download - -# Copy the rest of the application code -COPY ./src ./src - -# Build the Go binary with static linking for Linux -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o /server ./src - -COPY ./views ./views -COPY ./build_number ./build_number - FROM scratch # Set the current working directory inside the container WORKDIR /app -COPY . . -COPY --from=builder server ./ +COPY ./server . +COPY ./views ./views +COPY ./data ./data +COPY ./js ./js +COPY ./css ./css +COPY ./build_number ./build_number +# COPY --from=builder server ./ # Command to run the executable CMD ["./server"]