From 2acfbc88428a3be6322287ce2131297648a4a428 Mon Sep 17 00:00:00 2001 From: sn0w Date: Thu, 10 Jan 2019 19:03:52 +0100 Subject: [PATCH] Migrate to alpine linux wew that was easy --- Dockerfile | 25 +++++++++++-------------- README.md | 2 +- entrypoint.sh | 5 +++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16c5150..0bd34a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,9 @@ -FROM debian:9-slim +FROM alpine:3.8 # Set up environment -ENV MIX_ENV=prod -ENV DEBIAN_FRONTEND=noninteractive ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 +ENV MIX_ENV=prod # Prepare mounts VOLUME /custom.d @@ -12,18 +11,16 @@ VOLUME /custom.d # Expose default pleroma port to host EXPOSE 4000 -# Get erlang, elixir, and dependencies +# Get dependencies RUN \ - apt-get update \ - && apt-get install -y --no-install-recommends apt-utils \ - && apt-get install -y --no-install-recommends git wget ca-certificates gnupg2 build-essential ruby \ + apk add --no-cache --virtual .tools \ + git curl \ \ - && wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb \ - && dpkg -i erlang-solutions_1.0_all.deb \ - && apt-get update \ - && apt-get install -y --no-install-recommends esl-erlang elixir \ + && apk add --no-cache --virtual .sdk \ + build-base \ \ - && rm -rf /var/lib/apt/lists/* + && apk add --no-cache --virtual .runtime \ + erlang erlang-runtime-tools erlang-xmerl elixir # Add entrypoint COPY ./entrypoint.sh / @@ -36,8 +33,8 @@ ARG DOCKER_GID=1000 ARG PLEROMA_UPLOADS_PATH=/uploads RUN \ - groupadd --gid ${DOCKER_GID} pleroma \ - && useradd -m -s /bin/bash --gid ${DOCKER_GID} --uid ${DOCKER_UID} pleroma \ + addgroup --gid ${DOCKER_GID} pleroma \ + && adduser -S -s /bin/ash -G pleroma -u ${DOCKER_UID} pleroma \ && mkdir -p /custom.d $PLEROMA_UPLOADS_PATH \ && chown -R pleroma:pleroma /custom.d $PLEROMA_UPLOADS_PATH diff --git a/README.md b/README.md index 5203c50..4556eca 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ or guides from the community. A few are linked below. This list is not exhaustiv ### Prerequisites -- 1-2GB of free HDD space (yeah it sucks, Alpine Linux soontm) +- 500mb of free HDD space - `m4` and `awk` in remotely recent versions - `curl` or `wget` if you want smarter build caches and commands like `./pleroma mod` - `jq` and `dialog` if you want to use `./pleroma mod` diff --git a/entrypoint.sh b/entrypoint.sh index 422e7fb..6abb603 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,10 @@ -#!/bin/bash +#!/bin/ash +# shellcheck shell=dash set -e set -x -if [[ -n "$BUILDTIME" ]]; then +if [ -n "$BUILDTIME" ]; then mix local.rebar --force mix local.hex --force