Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters