-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
84 lines (65 loc) · 2.55 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Dockerfile
#
# docker run --rm -d --name miniircd helje5/nio-miniircd:latest
# docker run --rm -d -p 127.0.0.1:1337:80 \
# -p 127.0.0.1:6667:6667 \
# --name miniircd helje5/nio-miniircd:latest
#
# Attach w/ new shell
#
# docker exec -it miniircd bash
#
# To build:
#
# docker build -t helje5/nio-miniircd:latest .
# docker push helje5/nio-miniircd:latest
#
# Rebuild:
#
# docker build --no-cache -t helje5/nio-miniircd:latest .
#
# Build Image
# - this just builds miniircd and its depdencies
# - we also grab the necessary Swift runtime libs from this
FROM swift:4.2.1 AS builder
LABEL maintainer "Helge Heß <[email protected]>"
ENV DEBIAN_FRONTEND noninteractive
ENV CONFIGURATION release
ENV NIO_DAEMON_INSTALL_DIR /opt/miniircd/bin
WORKDIR /src/
COPY Sources Sources
COPY Package.swift .
RUN mkdir -p ${NIO_DAEMON_INSTALL_DIR}
RUN swift build -c ${CONFIGURATION}
RUN cp Package.resolved ${NIO_DAEMON_INSTALL_DIR}/miniircd-Package.resolved
RUN cp $(swift build -c ${CONFIGURATION} --show-bin-path)/miniircd \
${NIO_DAEMON_INSTALL_DIR}/
# Deployment Image
# - we copy in the shared libs from the builder image /usr/lib/swift/linux/
# - we copy in /opt/miniircd/bin from the builder image
# - we generate a supervise run script
FROM ubuntu:16.04
LABEL maintainer "Helge Heß <[email protected]>"
LABEL description "A MiniIRCd deployment container"
RUN apt-get -q update && apt-get -q -y install \
libatomic1 libbsd0 libcurl3 libicu55 libxml2 \
daemontools \
&& rm -r /var/lib/apt/lists/*
WORKDIR /
COPY --from=builder /usr/lib/swift/linux/*.so /usr/lib/swift/linux/
COPY --from=builder /opt/miniircd/bin /opt/miniircd/bin
EXPOSE 1337
EXPOSE 6667
EXPOSE 80
WORKDIR /opt/miniircd
RUN mkdir -p /opt/miniircd/logs
RUN bash -c "echo '#!/bin/bash' > run; \
echo '' >> run; \
echo echo RUN Started \$\(date\) \>\>logs/run.log >> run; \
echo '' >> run; \
echo stdbuf -oL -eL ./bin/miniircd --web http://0.0.0.0:80/websocket --extweb wss://irc.noze.io:443/websocket \>\>logs/run.log 2\>\>logs/error.log >> run; \
echo '' >> run; \
echo echo RUN Finished \$\(date\) \>\>logs/run.log >> run; \
echo echo RUN ------------------- \>\>logs/run.log >> run; \
chmod +x run"
CMD ["supervise", "/opt/miniircd"]