Skip to content

Commit d64156e

Browse files
committed
Create dockerfile
1 parent 2e4b1e6 commit d64156e

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Build Docker image
19+
uses: docker/build-push-action@v5
20+
with:
21+
context: .
22+
push: false
23+
tags: transaction-latency:latest
24+
cache-from: type=gha
25+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.24-alpine AS builder
2+
WORKDIR /app
3+
COPY go.mod go.sum ./
4+
RUN go mod download
5+
COPY . .
6+
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
7+
8+
FROM alpine:latest
9+
WORKDIR /app
10+
COPY --from=builder /app/main .
11+
CMD ["./main"]

0 commit comments

Comments
 (0)