Building the package:
nix-build -E '(import ./pkgs.nix).callPackage ./default.nix {}'Building the releases:
nix-build ./release.nix --attr application
nix-build ./release.nix --attr dockerInstall into Nix user profile:
nix-env -f ./release.nix --install --attr applicationInstall into Docker:
docker load --input "$(nix-build ./release.nix --attr docker)"http-demo 55555
curl http://localhost:55555/Or after you have tagged your container image with latest:
docker run -it --rm --network=host http-demo:latest 55555Or with port mapping:
docker run -it --rm -p 55555:55555 http-demo:INSERTYOURTAG 55555First login to AWS ECR:
aws --profile=matrix ecr get-login-password --region ap-southeast-2 | docker login --username AWS --password-stdin 015248367786.dkr.ecr.ap-southeast-2.amazonaws.comProceed to build the container image and upload it:
repo="015248367786.dkr.ecr.ap-southeast-2.amazonaws.com" && \
build="$(nix-build ./release.nix --attr docker)" && \
loaded="$(docker load --input "$build")" && \
name="$(cut -d':' -f2 <<< "$loaded" | tr -d ' ')" && \
tag="$(cut -d':' -f3 <<< "$loaded")" && \
docker tag "${name}:${tag}" "${repo}/http-demo:${tag}" && \
docker tag "${name}:${tag}" "${repo}/http-demo:latest" && \
docker push "${repo}/http-demo:${tag}" && \
docker push "${repo}/http-demo:latest"Because the container is built with an Entrypoint, set the Command to only the parameters.