Skip to content

Commit

Permalink
Replace Vagrant with Docker Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosabalde committed Feb 2, 2024
1 parent 5fa4ce7 commit 2a76c6a
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 86 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.env

Makefile
Makefile.in
.deps/
Expand Down
74 changes: 74 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
FROM ubuntu:jammy-20220428

ENV DEBIAN_FRONTEND noninteractive

RUN groupadd -g 5000 dev \
&& useradd -u 5000 -g 5000 -m -s /bin/bash dev

RUN apt update \
&& apt install -y \
apt-transport-https \
automake \
autotools-dev \
bindfs \
binutils \
curl \
dpkg-dev \
git \
gpg \
graphviz \
jq \
less \
libedit-dev \
libev-dev \
libjemalloc-dev \
libncurses-dev \
libpcre2-dev \
libssl-dev \
libtool \
make \
nano \
netcat \
pkg-config \
python3 \
python3-docutils \
python3-sphinx \
python3-venv \
tar \
telnet \
unzip \
wget \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

RUN cd /tmp \
&& wget --no-check-certificate https://varnish-cache.org/_downloads/varnish-7.4.0.tgz \
&& tar zxvf varnish-*.tgz \
&& rm -f varnish-*.tgz \
&& cd varnish-* \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make PREFIX='/usr/local' install \
&& ldconfig

RUN cd /tmp \
&& wget --no-check-certificate https://github.com/redis/hiredis/archive/v1.2.0.zip -O hiredis-1.2.0.zip \
&& unzip hiredis-*.zip \
&& rm -f hiredis-*.zip \
&& cd hiredis* \
&& make USE_SSL=1 \
&& make USE_SSL=1 PREFIX='/usr/local' install \
&& ldconfig

RUN cd /tmp \
&& wget --no-check-certificate http://download.redis.io/releases/redis-7.0.9.tar.gz \
&& tar zxvf redis-*.tar.gz \
&& rm -f redis-*.tar.gz \
&& cd redis-* \
&& make BUILD_TLS=yes \
&& make BUILD_TLS=yes PREFIX='/usr/local' install \
&& ldconfig

COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
86 changes: 0 additions & 86 deletions Vagrantfile

This file was deleted.

34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

#
# Cheat sheet:
# $ echo -e "UID=$(id -u)\nGID=$(id -g)" > .env
# $ docker compose up --build --detach
# $ docker compose exec --user dev --workdir /mnt/host dev bash
# $ ./autogen.sh
# $ ./configure
# $ make
# $ make check
# $ docker compose down --volumes --remove-orphans
#

version: '3.7'

name: libvmod-redis-7_4

services:
dev:
hostname: dev
build:
context: .
privileged: true
environment:
HOST_UID: ${UID:?}
HOST_GID: ${GID:?}
volumes:
- .:/mnt/host.raw
tmpfs:
- /run
- /run/lock
- /var/cache
- /tmp:exec
16 changes: 16 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

mkdir -p /mnt/host

# Beware 'privileged: true' is required for this.
bindfs \
--force-user=$(id -u dev) \
--force-group=$(id -g dev) \
--create-for-user=$HOST_UID \
--create-for-group=$HOST_GID \
--chown-ignore \
--chgrp-ignore \
/mnt/host.raw \
/mnt/host

tail -f /dev/null

0 comments on commit 2a76c6a

Please sign in to comment.