added workflows
This commit is contained in:
		
							parent
							
								
									bf621ba223
								
							
						
					
					
						commit
						e0c8cc9c74
					
				
							
								
								
									
										37
									
								
								.gitea/.workflow/build-push.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								.gitea/.workflow/build-push.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
# Build docker image and push it to registry
 | 
			
		||||
name: Build and Push
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
    tags:
 | 
			
		||||
      - *
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - name: Set up QEMU
 | 
			
		||||
        uses: docker/setup-qemu-action@v1
 | 
			
		||||
 | 
			
		||||
      - name: Set up Docker Buildx
 | 
			
		||||
        uses: docker/setup-buildx-action@v1
 | 
			
		||||
 | 
			
		||||
      - name: Login to Gitea Container Registry
 | 
			
		||||
        uses: docker/login-action@v1
 | 
			
		||||
        with:
 | 
			
		||||
          registry: gitea.rannes.dev
 | 
			
		||||
          username: ${{ secrets.REGISTRY_USERNAME }}
 | 
			
		||||
          password: ${{ secrets.REGISTRY_TOKEN }}
 | 
			
		||||
 | 
			
		||||
      - name: Build and push
 | 
			
		||||
        uses: docker/build-push-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          context: .
 | 
			
		||||
          platforms: linux/amd64,linux/arm64
 | 
			
		||||
          push: true
 | 
			
		||||
          tags: hooklord/confetti-trigger:${{ github.ref_name }}
 | 
			
		||||
							
								
								
									
										37
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
# Use a multi-stage build to create a minimal Docker image
 | 
			
		||||
 | 
			
		||||
# Stage 1: Build the Go application
 | 
			
		||||
FROM golang:1.23-alpine as builder
 | 
			
		||||
 | 
			
		||||
# Set the working directory inside the container
 | 
			
		||||
WORKDIR /app
 | 
			
		||||
 | 
			
		||||
# Copy go.mod and go.sum files if you have them
 | 
			
		||||
COPY go.mod go.sum ./
 | 
			
		||||
 | 
			
		||||
# Download all dependencies
 | 
			
		||||
RUN go mod download
 | 
			
		||||
 | 
			
		||||
# Copy the source code into the container
 | 
			
		||||
COPY . .
 | 
			
		||||
 | 
			
		||||
# Build the Go application
 | 
			
		||||
RUN go build -o confetti-api main.go
 | 
			
		||||
 | 
			
		||||
# Stage 2: Create a minimal image with the application binary
 | 
			
		||||
FROM alpine:latest
 | 
			
		||||
 | 
			
		||||
# Install ca-certificates to handle HTTPS requests
 | 
			
		||||
RUN apk --no-cache add ca-certificates
 | 
			
		||||
 | 
			
		||||
# Set the working directory inside the container
 | 
			
		||||
WORKDIR /root/
 | 
			
		||||
 | 
			
		||||
# Copy the binary from the builder stage
 | 
			
		||||
COPY --from=builder /app/confetti-api .
 | 
			
		||||
 | 
			
		||||
# Expose port 8080 for the application
 | 
			
		||||
EXPOSE 8080
 | 
			
		||||
 | 
			
		||||
# Command to run the application
 | 
			
		||||
CMD ["./confetti-api"]
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user