Created
January 5, 2018 21:54
-
-
Save danielkza/cffa016d693a26e52752672936034e32 to your computer and use it in GitHub Desktop.
Bors-NG Docker setup
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
#!/bin/sh | |
set -x | |
db_addr="${DATABASE_URL##*@}" | |
db_addr="${db_addr%%/*}" | |
dockerize -wait "tcp://$db_addr" true | |
if [ "$BORSNG_DB_AUTO_MIGRATE" = "1" ]; then | |
./bors_frontend/bin/bors_frontend command Elixir.BorsNG.Database.Migrate up | |
fi | |
exec "$@" |
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
ARG ELIXIR_VERSION=1.4.5 | |
FROM elixir:${ELIXIR_VERSION} as builder | |
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | |
RUN apt-get update -q && apt-get install -y build-essential libtool autoconf curl | |
RUN DEBIAN_CODENAME=$(sed -n 's/VERSION=.*(\(.*\)).*/\1/p' /etc/os-release) && \ | |
curl -q https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ | |
echo "deb http://deb.nodesource.com/node_8.x $DEBIAN_CODENAME main" | tee /etc/apt/sources.list.d/nodesource.list && \ | |
apt-get update -q && \ | |
apt-get install -y nodejs | |
RUN mix local.hex --force && \ | |
mix local.rebar --force && \ | |
mix hex.info | |
WORKDIR /app | |
ADD ./bors-ng/ /app/ | |
# Set default environment for building | |
ENV MIX_ENV=prod | |
RUN mix deps.get | |
RUN cd /app/apps/bors_frontend && npm install && npm run deploy | |
RUN mix phx.digest | |
RUN mix release --env=$MIX_ENV | |
#### | |
FROM debian:jessie-slim | |
RUN apt-get update -q && apt-get install -y --no-install-recommends git-core libssl1.0.0 curl ca-certificates | |
ENV DOCKERIZE_VERSION=v0.6.0 | |
RUN curl -Ls https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | \ | |
tar xzv -C /usr/local/bin | |
ADD ./bors-ng-entrypoint /usr/local/bin/ | |
COPY --from=builder /app/_build/prod/rel/ /app/ | |
ENV LANG=C.UTF-8 | |
ENV BORSNG_DB_AUTO_MIGRATE=1 | |
ENV ALLOW_PRIVATE_REPOS=true | |
WORKDIR /app | |
ENTRYPOINT ["/usr/local/bin/bors-ng-entrypoint"] | |
CMD ["./bors_frontend/bin/bors_frontend", "foreground"] | |
EXPOSE $PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note to future readers: this is outdated. The Dockerfile in the bors-ng repo itself, and the bors-ng image on the Docker Hub is actually recommended.