Skip to content

Commit 52c949a

Browse files
committed
feat: build and publish weekly alpha/development container image
1 parent adb3266 commit 52c949a

File tree

4 files changed

+148
-14
lines changed

4 files changed

+148
-14
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: weekly docker build
2+
on:
3+
schedule:
4+
- cron: '0 0 * * 1' # Monday midnight
5+
workflow_dispatch:
6+
7+
permissions:
8+
packages: write
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
weekly-container-build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
submodules: true
22+
23+
- name: Set up QEMU
24+
id: qemu
25+
uses: docker/setup-qemu-action@v1
26+
with:
27+
platforms: arm64,amd64
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v1
31+
- name: Login to GitHub Container Registry
32+
uses: docker/login-action@v2
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.repository_owner }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Docker meta
39+
id: metadata
40+
uses: docker/metadata-action@v3
41+
with:
42+
images: |
43+
ghcr.io/${{ github.repository }}
44+
tags: |
45+
type=raw,value=alpha
46+
type=raw,value=alpha-{{date 'YYYYMMDD'}}
47+
type=raw,value=alpha-{{sha}}
48+
49+
- name: Build release image
50+
uses: docker/build-push-action@v3
51+
with:
52+
context: .
53+
platforms: linux/amd64,linux/arm64
54+
build-args: |
55+
QEMU_CPU=max,pauth-impdef=on
56+
push: true
57+
tags: ${{ steps.metadata.outputs.tags }}
58+
labels: ${{ steps.metadata.outputs.labels }}
59+
file: tools/docker/Dockerfile.ubuntu-build
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.PHONY: default
2+
3+
configure:
4+
./helio/blaze.sh -release -DBoost_USE_STATIC_LIBS=ON -DOPENSSL_USE_STATIC_LIBS=ON \
5+
-DENABLE_GIT_VERSION=ON -DWITH_UNWIND=OFF -DHELIO_RELEASE_FLAGS="-flto"
6+
7+
build:
8+
cd build-opt; \
9+
ninja dragonfly; \
10+
ldd dragonfly
11+
12+
package:
13+
ARCH=`uname -m`
14+
NAME="dragonfly-${ARCH}"
15+
16+
cd build-opt; \
17+
mv dragonfly $NAME; \
18+
tar cvfz $NAME.unstripped.tar.gz $NAME ../LICENSE.md; \
19+
strip $NAME; \
20+
tar cvfz $NAME.tar.gz $NAME ../LICENSE.md
21+
22+
release: configure build
23+
24+
default: release
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# syntax=docker/dockerfile:1
2+
FROM ubuntu:20.04 as builder
3+
4+
WORKDIR /build
5+
6+
COPY . ./
7+
8+
# install build dependencies
9+
# taken from https://github.com/dragonflydb/dragonfly/blob/main/.github/workflows/release.yml#L60-L65
10+
RUN export DEBIAN_FRONTEND=noninteractive && \
11+
apt update && \
12+
apt install -q -y autoconf-archive cmake curl git libssl-dev \
13+
libunwind-dev ninja-build libtool gcc-9 g++-9 libboost-fiber-dev \
14+
libxml2-dev zip libzstd-dev
15+
16+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 40 \
17+
--slave /usr/bin/g++ g++ /usr/bin/g++-9
18+
19+
# build
20+
# taken from https://github.com/dragonflydb/dragonfly/blob/main/tools/release.sh
21+
RUN make release
22+
23+
RUN build-opt/dragonfly --version
24+
25+
RUN curl -O https://raw.githubusercontent.com/ncopa/su-exec/212b75144bbc06722fbd7661f651390dc47a43d1/su-exec.c && \
26+
gcc -Wall -O2 su-exec.c -o su-exec
27+
28+
# Now prod image
29+
FROM ubuntu:20.04
30+
31+
# ARG in fact change the env vars during the build process
32+
# ENV persist the env vars for the built image as well.
33+
ARG DEBIAN_FRONTEND=noninteractive
34+
35+
RUN apt clean && apt update && apt -y install netcat-openbsd
36+
37+
RUN groupadd -r -g 999 dfly && useradd -r -g dfly -u 999 dfly
38+
RUN mkdir /data && chown dfly:dfly /data
39+
40+
VOLUME /data
41+
WORKDIR /data
42+
COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
43+
COPY tools/docker/healthcheck.sh /usr/local/bin/healthcheck.sh
44+
COPY --from=builder /build/su-exec /usr/local/bin/
45+
COPY --from=builder /build/build-opt/dragonfly /usr/local/bin/
46+
47+
HEALTHCHECK CMD /usr/local/bin/healthcheck.sh
48+
ENTRYPOINT ["entrypoint.sh"]
49+
50+
# For inter-container communication.
51+
EXPOSE 6379
52+
53+
CMD ["dragonfly", "--logtostderr"]

tools/release.sh

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22

33
set -e
44

5-
if ! [ -d helio ]; then
6-
echo "could not find helio"
5+
if ! [ -f "helio/blaze.sh" ]; then
6+
echo "ERROR"
7+
echo "Could not find helio. Please only run this script from repo root."
8+
echo "If you are already on the repo root, you might've cloned without submodules."
9+
echo "Try running 'git submodule update --init --recursive'"
710
exit 1
811
fi
912

10-
ARCH=`uname -m`
11-
NAME="dragonfly-${ARCH}"
12-
1313
pwd
14-
./helio/blaze.sh -release -DBoost_USE_STATIC_LIBS=ON -DOPENSSL_USE_STATIC_LIBS=ON \
15-
-DENABLE_GIT_VERSION=ON -DWITH_UNWIND=OFF -DHELIO_RELEASE_FLAGS="-flto"
1614

17-
cd build-opt
18-
ninja dragonfly && ldd dragonfly
19-
./dragonfly --version
20-
mv dragonfly $NAME
21-
tar cvfz $NAME.unstripped.tar.gz $NAME ../LICENSE.md
22-
strip $NAME
23-
tar cvfz $NAME.tar.gz $NAME ../LICENSE.md
15+
make release
16+
17+
build-opt/dragonfly --version
18+
19+
make package

0 commit comments

Comments
 (0)