spejstore/Dockerfile.nixified

50 lines
1.3 KiB
Docker

# syntax = docker/dockerfile:1.2
FROM nixos/nix as nix-base
ENV PYTHONUNBUFFERED 1
RUN nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs && \
nix-channel --update
WORKDIR /code
RUN wget https://github.com/vishnubob/wait-for-it/raw/8ed92e8cab83cfed76ff012ed4a36cef74b28096/wait-for-it.sh -O /usr/local/bin/wait-for-it.sh && chmod +x /usr/local/bin/wait-for-it.sh
RUN nix-env -iA nixpkgs.git nixpkgs.bash nixpkgs.coreutils
ADD ./nix ./nix
ADD ./spejstore.nix .
ADD ./labelmaker/*.nix ./labelmaker/
ADD ./labelmaker/Gemfile* ./labelmaker/
ADD ./poetry.lock .
ADD ./pyproject.toml .
FROM nix-base as spejstore
RUN touch spejstore.py # poetry must think there's a module, so we mock a trivial one
RUN nix-env -if spejstore.nix
RUN rm spejstore.py
ADD *.env .
ADD *.py .
ADD auth ./auth
ADD dist ./dist
ADD python-modules ./python-modules
ADD spejstore ./spejstore
ADD static ./static
ADD storage ./storage
ADD templates ./templates
RUN nix-env -if ./spejstore.nix
CMD /usr/local/bin/wait-for-it.sh db:5432 && manage-py migrate && \
manage-py runserver 0.0.0.0:8000
FROM nix-base as labelmaker
RUN nix-env -if ./labelmaker/default.nix
ADD labelmaker labelmaker
RUN nix-env -if ./labelmaker/default.nix
ENV LPR_PRINTER_NAME=fake-printer
CMD labelmaker