Skip to content

Commit

Permalink
Add Docker build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
christophetd committed Jun 14, 2024
1 parent 8bf9291 commit ab42e01
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ jobs:
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Local docker build
run: docker build . -t attache
41 changes: 41 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: docker

on:
push:
tags:
- "*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: datadog/attache

permissions:
contents: read

jobs:
docker-build-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.22-alpine AS builder
WORKDIR /build
RUN apk add --update make
ADD . /build
RUN make attache

FROM golang:1.22-alpine AS runner
LABEL org.opencontainers.image.source="https://github.com/DataDog/attache/"
COPY --from=builder /build/attache /attache
ENTRYPOINT ["/attache"]

0 comments on commit ab42e01

Please sign in to comment.