-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
コンテナ化した #70
- Loading branch information
Showing
22 changed files
with
257 additions
and
119 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
/bin/ | ||
websh_server/bin/* | ||
websh_server/tests/twebsh_server | ||
websh_server/tmp/* | ||
!websh_server/tmp/.gitkeep | ||
|
||
websh_server/bin/websh_server | ||
websh_front/public/js/index.js | ||
websh_front/tests/*.js | ||
|
||
websh_server/tests/twebsh_server | ||
|
||
websh_server/bin/websh_remover | ||
websh_server/tools/visor | ||
websh_remover/bin/* |
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 |
---|---|---|
@@ -1,14 +1,48 @@ | ||
FROM ubuntu:19.10 | ||
FROM alpine:3.12 AS base | ||
|
||
RUN apt-get update -yqq \ | ||
&& apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
build-essential \ | ||
git \ | ||
; | ||
RUN apk add --no-cache \ | ||
alpine-sdk | ||
|
||
ENV PATH /root/.nimble/bin:$PATH | ||
RUN curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh | ||
RUN sh init.sh -y \ | ||
&& choosenim devel | ||
|
||
# install nim (#devel) and nim-tools | ||
RUN mkdir -p /nim && \ | ||
git clone https://github.com/nim-lang/Nim /nim && \ | ||
cd /nim && \ | ||
sh build_all.sh && \ | ||
ln -s `pwd`/bin/nim /bin/nim && \ | ||
nim c koch && \ | ||
./koch tools && \ | ||
ln -s `pwd`/bin/nimble /bin/nimble && \ | ||
ln -s `pwd`/bin/nimsuggest /bin/nimsuggest | ||
|
||
RUN mkdir /work | ||
WORKDIR /work | ||
|
||
################################################################################ | ||
# builder stages | ||
################################################################################ | ||
|
||
FROM base AS websh_front_builder | ||
COPY websh_front/ /work | ||
RUN nimble build -Y | ||
|
||
FROM base AS websh_server_builder | ||
COPY websh_server/ /work | ||
RUN nimble build -Y -d:release | ||
|
||
FROM base AS websh_remover_builder | ||
COPY websh_remover/ /work | ||
RUN nimble build -Y -d:release | ||
|
||
################################################################################ | ||
# runtime stages | ||
################################################################################ | ||
|
||
FROM alpine:3.12 AS websh_server_runtime | ||
COPY --from=websh_server_builder /work/bin/websh_server /usr/local/bin/ | ||
ENTRYPOINT ["/usr/local/bin/websh_server"] | ||
|
||
FROM alpine:3.12 AS websh_remover_runtime | ||
COPY --from=websh_remover_builder /work/bin/websh_remover /usr/local/bin/ | ||
ENTRYPOINT ["/usr/local/bin/websh_remover"] |
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
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,24 @@ | ||
FROM ubuntu:19.10 | ||
|
||
RUN apt-get update -yqq && \ | ||
apt-get install -yqq --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
git \ | ||
&& \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN git clone --depth 1 https://github.com/nim-lang/Nim && \ | ||
cd Nim && \ | ||
bash build_all.sh | ||
|
||
ENV PATH $PWD/Nim/bin:$PATH | ||
|
||
RUN nimble install -Y \ | ||
jester \ | ||
karax \ | ||
regex \ | ||
; | ||
|
||
RUN nim --version && \ | ||
nimble --version |
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,10 @@ | ||
FROM nimlang/nim:1.0.6-ubuntu | ||
|
||
RUN nimble install -Y \ | ||
jester \ | ||
karax \ | ||
regex \ | ||
; | ||
|
||
RUN nim --version && \ | ||
nimble --version |
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,35 @@ | ||
FROM docker:19.03-dind AS base | ||
|
||
# Let's start with some basic stuff. | ||
RUN apk add --no-cache alpine-sdk | ||
RUN mkdir -p /nim && \ | ||
curl -sL "http://nim-lang.org/download/nim-1.0.6.tar.xz" | tar xJ --strip-components=1 -C /nim && \ | ||
cd /nim && \ | ||
sh build.sh && \ | ||
rm -r c_code tests | ||
|
||
ENV PATH=/nim/bin:/root/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
|
||
WORKDIR /nim | ||
RUN nim c -d:release koch.nim && \ | ||
./koch nimble | ||
|
||
RUN nim --version && \ | ||
nimble --version | ||
|
||
|
||
FROM base AS builder | ||
|
||
COPY nimbot_executor /work | ||
RUN cd /work && nimble install -Y | ||
|
||
|
||
FROM docker:19.03-dind AS runtime | ||
|
||
RUN apk add --update --no-cache tzdata && \ | ||
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \ | ||
echo "Asia/Tokyo" > /etc/timezone && \ | ||
apk del tzdata | ||
|
||
COPY --from=builder /root/.nimble/bin/nimbot_executor /usr/local/bin/nimbot_executor | ||
ENTRYPOINT ["/usr/local/bin/nimbot_executor"] |
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,5 @@ | ||
FROM fluentd:v1.9-1 AS runtime | ||
|
||
USER root | ||
RUN mkdir /var/log/nimbot | ||
COPY conf/fluentd /fluentd/etc |
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,18 @@ | ||
FROM nimlang/nim:1.0.6-ubuntu AS builder | ||
|
||
COPY nimbot_server /work | ||
RUN cd /work && nimble install -Y | ||
|
||
|
||
FROM nimlang/nim:1.0.6-ubuntu AS runtime | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update -yqq && \ | ||
apt-get install -y tzdata && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
ENV TZ=Asia/Tokyo | ||
|
||
COPY --from=builder /root/.nimble/bin/nimbot_server /usr/local/bin/nimbot_server | ||
ENTRYPOINT ["/usr/local/bin/nimbot_server"] | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,12 +1,44 @@ | ||
version: '3' | ||
version: '3.7' | ||
|
||
services: | ||
proxy: | ||
nginx: | ||
image: nginx:1.17 | ||
volumes: | ||
- "./proxy/conf.d:/etc/nginx/conf.d:ro" | ||
- "./nginx/conf.d:/etc/nginx/conf.d:ro" | ||
- "./websh_front/public:/var/www:ro" | ||
ports: | ||
- "80:80" | ||
network_mode: "host" | ||
|
||
websh_front: | ||
build: &app-build | ||
context: . | ||
dockerfile: Dockerfile | ||
target: base | ||
volumes: | ||
- "./websh_front:/work" | ||
entrypoint: nimble | ||
command: | ||
- build | ||
- -Y | ||
- -d:local | ||
|
||
websh_server: | ||
build: *app-build | ||
volumes: | ||
- "./websh_server:/work" | ||
environment: | ||
HOST_PWD: "$PWD/websh_server" | ||
entrypoint: ./entrypoint.sh | ||
ports: | ||
- "5000:5000" | ||
network_mode: "host" | ||
|
||
websh_remover: | ||
build: *app-build | ||
volumes: | ||
- "./websh_remover:/work" | ||
- "./websh_server/tmp:/dirs" | ||
entrypoint: ./entrypoint.sh | ||
environment: | ||
WEBSH_REMOVER_DIR: "/dirs" |
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
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,6 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
nimble build -Y | ||
./bin/websh_remover |
Oops, something went wrong.