Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
helje5 committed Apr 24, 2017
2 parents 4c867ee + 3e99941 commit 9bb9cbf
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .docker/Makefile
@@ -0,0 +1,17 @@
# Makefile

all : demo

demo :
time docker build \
-t modswift/mod_swift-demo:latest \
-t modswift/mod_swift-demo:3.1.0 \
-f mod_swift-demo.dockerfile \
$(PWD)

demo-dev :
time docker build \
-t modswift/mod_swift-demo-dev:latest \
-t modswift/mod_swift-demo-dev:3.1.0 \
-f mod_swift-demo-dev.dockerfile \
$(PWD)
28 changes: 28 additions & 0 deletions .docker/mod_swift-demo-dev.dockerfile
@@ -0,0 +1,28 @@
# Dockerfile
#
# docker run -i --tty --rm -p 8042:8042 modswift/mod_swift-demo-dev
#
FROM modswift/mod_swift-demo

# rpi-swift sets it to swift
USER root

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get install -y vim emacs make wget sudo


# setup sudo

RUN adduser swift sudo
RUN echo 'swift ALL=(ALL:ALL) ALL' > /etc/sudoers.d/swift
RUN chmod 0440 /etc/sudoers.d/swift
RUN echo 'swift:swift' | chpasswd


USER swift

ARG MOD_SWIFT_VERSION=0.7.6
WORKDIR /home/swift/mod_swift-$MOD_SWIFT_VERSION

CMD bash
57 changes: 57 additions & 0 deletions .docker/mod_swift-demo.dockerfile
@@ -0,0 +1,57 @@
# Dockerfile
#
# docker run --name mod_swift-demo -p 8042:8042 -d modswift/mod_swift-demo
#
# time docker build -t modswift/mod_swift-demo:latest \
# -t modswift/mod_swift-demo:3.1.0 \
# -f mod_swift-demo.dockerfile \
# .
#
FROM swift:3.1.0

ARG MOD_SWIFT_VERSION=0.7.6

# rpi-swift sets it to swift
USER root

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get -q update
RUN apt-get install -y wget curl \
autoconf libtool pkg-config \
apache2 apache2-dev

# dirty hack to get Swift module for APR working on Linux
# (Note: I've found a better way, stay tuned.)
RUN bash -c "\
head -n -6 /usr/include/apr-1.0/apr.h > /tmp/zz-apr.h; \
echo '' >> /tmp/zz-apr.h; \
echo '// mod_swift build hack' >> /tmp/zz-apr.h; \
echo 'typedef int pid_t;' >> /tmp/zz-apr.h; \
tail -n 6 /usr/include/apr-1.0/apr.h >> /tmp/zz-apr.h; \
mv /usr/include/apr-1.0/apr.h /usr/include/apr-1.0/apr-original.h; \
mv /tmp/zz-apr.h /usr/include/apr-1.0/apr.h"


# fixup Swift docker install, CoreFoundation lacks other-r flags
# https://github.com/swiftdocker/docker-swift/issues/70
RUN chmod -R o+r /usr/lib/swift


# create Swift user

RUN useradd --create-home --shell /bin/bash swift
USER swift
WORKDIR /home/swift

RUN bash -c "curl -L https://github.com/AlwaysRightInstitute/mod_swift/archive/$MOD_SWIFT_VERSION.tar.gz | tar zx"

WORKDIR /home/swift/mod_swift-$MOD_SWIFT_VERSION

RUN make all

EXPOSE 8042

CMD LD_LIBRARY_PATH="$PWD/.libs:$LD_LIBRARY_PATH" \
EXPRESS_VIEWS=mods_expressdemo/views apache2 \
-X -d $PWD -f apache-ubuntu.conf
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -7,6 +7,7 @@
![Swift3](https://img.shields.io/badge/swift-3-blue.svg)
![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat)
![tuxOS](https://img.shields.io/badge/os-tuxOS-green.svg?style=flat)
![Raspiberry Pi](https://img.shields.io/badge/works%20on-Raspberry%20Pi-CA0B3D.svg?style=flat)
![Travis](https://travis-ci.org/AlwaysRightInstitute/mod_swift.svg?branch=master)

**mod_swift** is a technology demo which shows how to write native modules
Expand Down

0 comments on commit 9bb9cbf

Please sign in to comment.