Skip to content

Commit

Permalink
Add Dockerfile and cd for pushing nightly docker images (#9313)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com>
  • Loading branch information
mangalaman93 and ryanfoxtyler authored Feb 20, 2025
1 parent a2a4fa8 commit 7c532be
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 16 deletions.
6 changes: 2 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/contrib
/wiki
/.git
/.github
wiki
.github
29 changes: 29 additions & 0 deletions .github/workflows/cd-dgraph-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Push Docker Image

on:
schedule:
- cron: 0 0 * * *

permissions:
contents: read
packages: write

jobs:
build:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: docker/setup-buildx-action@v3.9.0

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6.13.0
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/hypermodeinc/dgraph-standalone:nightly
10 changes: 5 additions & 5 deletions .github/workflows/cd-dgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:

jobs:
dgraph-build-amd64:
runs-on: warp-ubuntu-latest-x64-16x
runs-on: warp-ubuntu-latest-x64-4x
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
path: dgraph-standalone-amd64.tar

dgraph-build-arm64:
runs-on: warp-ubuntu-latest-arm64-16x
runs-on: warp-ubuntu-latest-arm64-4x
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
run: |
#!/bin/bash
GIT_TAG_NAME='${{ github.event.inputs.releasetag }}'
if [[ "$GIT_TAG_NAME" == "v"* ]];
if [[ "$GIT_TAG_NAME" == "v"* ]];
then
echo "this is a release branch"
else
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:

graph-docker-image-and-manifests-push:
needs: [dgraph-build-amd64, dgraph-build-arm64]
runs-on: warp-ubuntu-latest-x64-16x
runs-on: warp-ubuntu-latest-x64-4x
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
Expand All @@ -232,7 +232,7 @@ jobs:
run: |
#!/bin/bash
GIT_TAG_NAME='${{ github.event.inputs.releasetag }}'
if [[ "$GIT_TAG_NAME" == "v"* ]];
if [[ "$GIT_TAG_NAME" == "v"* ]];
then
echo "this is a release branch"
else
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-dgraph-systest-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ permissions:
jobs:
dgraph-systest-tests:
if: github.event.pull_request.draft == false
runs-on: warp-ubuntu-latest-x64-4x
runs-on: warp-ubuntu-latest-x64-16x
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .trunk/configs/.checkov.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
skip-check:
- CKV_GHA_7
- CKV_DOCKER_2
2 changes: 2 additions & 0 deletions .trunk/configs/.trivyignore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
misconfigurations:
- id: AVD-DS-0026
12 changes: 6 additions & 6 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ lint:
enabled:
- trivy@0.59.1
- actionlint@1.7.7
- checkov@3.2.369
- checkov@3.2.372
- dotenv-linter@3.3.0
- git-diff-check
- gofmt@1.20.4
- golangci-lint@1.63.4
- golangci-lint@1.64.5
- hadolint@2.12.1-beta
- markdownlint@0.44.0
- osv-scanner@1.9.2
- oxipng@9.1.3
- prettier@3.5.0
- renovate@39.169.3
- oxipng@9.1.4
- prettier@3.5.1
- renovate@39.176.4
- shellcheck@0.10.0
- shfmt@3.6.0
- tflint@0.55.1
- trufflehog@3.88.7
- trufflehog@3.88.11
- yamllint@1.35.1
actions:
enabled:
Expand Down
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
###################### Stage I ######################
FROM golang:1.22.12 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2=1.0.8-5+b1 \
git=1:2.39.5-0+deb12u2 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /go/src/repo
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN CGO_ENABLED=0 make

###################### Stage II ######################
FROM ubuntu:24.04
LABEL maintainer="Hypermode Inc. <hello@hypermode.com>"
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates=20240203 \
curl=8.5.0-2ubuntu10.6 \
htop=3.3.0-4build1 \
iputils-ping=3:20240117-1build1 \
jq=1.7.1-3build1 \
less=590-2ubuntu2.1 \
sysstat=12.6.1-2 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /go/src/repo/dgraph/dgraph /usr/local/bin/
COPY --from=builder /go/src/repo/contrib/standalone/run.sh /
RUN chmod +x /run.sh
WORKDIR /dgraph
ENV GODEBUG=madvdontneed=1
CMD ["/run.sh"]

0 comments on commit 7c532be

Please sign in to comment.