nomad

HCL and Docker files for Nomad deployments
git clone https://git.in0rdr.ch/nomad.git
Log | Files | Refs | Pull requests

Dockerfile (924B)


      1 FROM python:3.10-bullseye AS builder
      2 
      3 # prepare python venv
      4 ENV VIRTUAL_ENV="/opt/venv"
      5 RUN python -m venv $VIRTUAL_ENV
      6 ENV PATH="$VIRTUAL_ENV/bin/:$PATH"
      7 
      8 # download latest 0x0
      9 WORKDIR /usr/src/app
     10 RUN curl -L https://git.0x0.st/mia/0x0/archive/master.tar.gz -o 0x0.tar.gz
     11 RUN tar -xf 0x0.tar.gz
     12 RUN rm -rf 0x0.tar.gz
     13 
     14 WORKDIR /usr/src/app/0x0
     15 
     16 # install python dependencies
     17 RUN pip install --upgrade pip wheel setuptools gunicorn
     18 RUN pip install -r requirements.txt
     19 
     20 
     21 FROM python:3.10-bullseye
     22 
     23 # reuse venv and 0x0 app code from builder
     24 COPY --from=builder /opt/venv /opt/venv
     25 COPY --from=builder /usr/src/app /usr/src/app
     26 ENV VIRTUAL_ENV="/opt/venv"
     27 ENV PATH="$VIRTUAL_ENV/bin/:$PATH"
     28 
     29 # bootstrap instance config
     30 WORKDIR /usr/src/app/0x0
     31 COPY instance instance
     32 
     33 # add flask user
     34 RUN useradd -m flask
     35 RUN chown -R flask: .
     36 USER flask
     37 
     38 EXPOSE 8000/tcp
     39 
     40 CMD ["gunicorn", "--workers=2", "fhost:app", "--bind=0.0.0.0:8000"]