forked from chubin/wttr.in
-
Notifications
You must be signed in to change notification settings - Fork 0
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
33 changed files
with
2,278 additions
and
847 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 |
---|---|---|
@@ -1,54 +1,70 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y curl \ | ||
git \ | ||
python \ | ||
python-pip \ | ||
python-dev \ | ||
autoconf \ | ||
libtool \ | ||
gawk | ||
RUN curl -O https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz | ||
RUN tar xvf go1.10.3.linux-amd64.tar.gz | ||
# Build stage | ||
FROM golang:1-alpine as builder | ||
|
||
WORKDIR /app | ||
|
||
COPY ./bin /app/bin | ||
COPY ./lib /app/lib | ||
COPY ./share /app/share | ||
COPY ./requirements.txt /app | ||
COPY ./src/we-lang/we-lang.go /app | ||
COPY ./share/we-lang/we-lang.go /app | ||
|
||
# There are several files that must be fetched/created manually | ||
# before building the image | ||
COPY ./.wegorc /root | ||
COPY ./.ip2location.key /root | ||
COPY ./airports.dat /app | ||
COPY ./GeoLite2-City.mmdb /app | ||
RUN apk add --no-cache git | ||
|
||
RUN export PATH=$PATH:/go/bin && \ | ||
go get -u github.com/mattn/go-colorable && \ | ||
|
||
RUN go get -u github.com/mattn/go-colorable && \ | ||
go get -u github.com/klauspost/lctime && \ | ||
go get -u github.com/mattn/go-runewidth && \ | ||
export GOBIN="/root/go/bin" && \ | ||
go install /app/we-lang.go | ||
CGO_ENABLED=0 go build /app/we-lang.go | ||
# Results in /app/we-lang | ||
|
||
|
||
RUN pip install -r requirements.txt | ||
FROM alpine:3 | ||
|
||
WORKDIR /app | ||
|
||
RUN mkdir /app/cache | ||
RUN mkdir -p /var/log/supervisor && \ | ||
mkdir -p /etc/supervisor/conf.d | ||
RUN chmod -R o+rw /var/log/supervisor && \ | ||
chmod -R o+rw /var/run | ||
COPY ./requirements.txt /app | ||
|
||
ENV LLVM_CONFIG=/usr/bin/llvm9-config | ||
|
||
RUN apk add --no-cache --virtual .build \ | ||
autoconf \ | ||
automake \ | ||
g++ \ | ||
gcc \ | ||
jpeg-dev \ | ||
llvm9-dev\ | ||
make \ | ||
zlib-dev \ | ||
&& apk add --no-cache \ | ||
python3 \ | ||
py3-pip \ | ||
py3-scipy \ | ||
py3-wheel \ | ||
py3-gevent \ | ||
zlib \ | ||
jpeg \ | ||
llvm9 \ | ||
libtool \ | ||
supervisor \ | ||
py3-numpy-dev \ | ||
python3-dev && \ | ||
mkdir -p /app/cache && \ | ||
mkdir -p /var/log/supervisor && \ | ||
mkdir -p /etc/supervisor/conf.d && \ | ||
chmod -R o+rw /var/log/supervisor && \ | ||
chmod -R o+rw /var/run && \ | ||
pip install -r requirements.txt --no-cache-dir && \ | ||
apk del --no-cache -r .build | ||
|
||
COPY --from=builder /app/we-lang /app/bin/we-lang | ||
COPY ./bin /app/bin | ||
COPY ./lib /app/lib | ||
COPY ./share /app/share | ||
COPY share/docker/supervisord.conf /etc/supervisor/supervisord.conf | ||
|
||
ENV WTTR_MYDIR="/app" | ||
ENV WTTR_GEOLITE="/app/GeoLite2-City.mmdb" | ||
ENV WTTR_WEGO="/root/go/bin/we-lang" | ||
ENV WTTR_WEGO="/app/bin/we-lang" | ||
ENV WTTR_LISTEN_HOST="0.0.0.0" | ||
ENV WTTR_LISTEN_PORT="8002" | ||
|
||
EXPOSE 8002 | ||
|
||
CMD ["/usr/local/bin/supervisord"] | ||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] |
Oops, something went wrong.