Feat: add dockerfile
This commit is contained in:
		
							
								
								
									
										20
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | # Build stage | ||||||
|  | FROM golang:1.24-alpine AS builder | ||||||
|  | WORKDIR /src | ||||||
|  | RUN apk add --no-cache build-base gcc | ||||||
|  | COPY go.mod go.sum ./ | ||||||
|  | RUN go mod download | ||||||
|  | COPY . . | ||||||
|  | RUN CGO_ENABLED=1 GOOS=linux go build -a -o /gralias . | ||||||
|  |  | ||||||
|  | # Final stage | ||||||
|  | FROM alpine:latest | ||||||
|  | WORKDIR /app | ||||||
|  | COPY --from=builder /gralias /app/gralias | ||||||
|  | # copy assets and templates | ||||||
|  | COPY assets ./assets | ||||||
|  | COPY components ./components | ||||||
|  | COPY config.example.toml ./config.toml | ||||||
|  | COPY migrations ./migrations | ||||||
|  | EXPOSE 3000 | ||||||
|  | CMD ["/app/gralias"] | ||||||
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							| @@ -32,7 +32,8 @@ stop-container: | |||||||
| 	docker rm -f gralias 2>/dev/null && echo "old container removed" | 	docker rm -f gralias 2>/dev/null && echo "old container removed" | ||||||
|  |  | ||||||
| run-container: stop-container | run-container: stop-container | ||||||
| 	docker run --name=gralias -v $(CURDIR)/store.json:/root/store.json -p 0.0.0.0:3000:3000 -d gralias:master | 	migrate -database 'sqlite3://gralias.db' -path migrations up | ||||||
|  | 	docker run --name=gralias -v $(CURDIR)/gralias.db:/app/gralias.db -p 0.0.0.0:3000:3000 -d gralias:master | ||||||
|  |  | ||||||
| migrate-up: | migrate-up: | ||||||
| 	migrate -database 'sqlite3://gralias.db' -path migrations up | 	migrate -database 'sqlite3://gralias.db' -path migrations up | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder