FROM heroku/heroku:16

RUN apt-get update && \
    apt-get install -y openjdk-8-jre-headless && \
    rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

RUN mkdir /app
RUN addgroup --quiet --gid 2000 slug && \
    useradd slug --uid=2000 --gid=2000 --home-dir /app --no-create-home \
        --shell /bin/bash

RUN locale-gen pt_BR.UTF-8

WORKDIR /app

# add default port to expose (can be overridden)
ENV PORT 5000
EXPOSE 5000

ADD ./runner /runner
ADD ./bin /bin
ADD https://storage.googleapis.com/object-storage-cli/bb8e054/objstorage-bb8e054-linux-amd64 /bin/objstorage
RUN chmod +x /bin/objstorage && \
    chown slug:slug /app \
                    /runner/init \
                    /bin/get_object \
                    /bin/objstorage

USER slug
ENV HOME /app
ENTRYPOINT ["/runner/init"]
