This commit is contained in:
Robin Appelman 2023-11-24 18:54:43 +01:00
commit 2517fcd669
3 changed files with 70 additions and 0 deletions

15
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,15 @@
on: [push, pull_request]
name: CI
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- run: nix build .#docker
- name: Push image
if: github.ref == 'refs/heads/main'
run: |
skopeo copy --dest-creds="${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_TOKEN }}" "docker-archive:$(nix build .#docker --print-out-paths)" "docker://demostf/maps"

7
README.md Normal file
View file

@ -0,0 +1,7 @@
# maps
Map overview images for tf2 maps
## Usage
See https://maps.demos.tf

View file

@ -14,6 +14,7 @@
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system overlays; inherit system overlays;
}; };
inherit (pkgs) writeText dockerTools;
inherit (pkgs.stdenv) mkDerivation; inherit (pkgs.stdenv) mkDerivation;
in rec { in rec {
packages = rec { packages = rec {
@ -44,6 +45,53 @@
cp -r ${images} $out/images cp -r ${images} $out/images
''; '';
}; };
nginxConf = writeText "nginx.conf" ''
user nobody nobody;
daemon off;
error_log /dev/stdout info;
pid /dev/null;
events {}
http {
include ${pkgs.nginx}/conf/mime.types;
access_log /dev/stdout;
server {
listen 80;
autoindex on;
charset utf-8;
location / {
root ${maps};
}
}
}
'';
docker = dockerTools.buildLayeredImage {
name = "demostf/maps";
tag = "latest";
maxLayers = 5;
contents = with pkgs; [
nginx
fakeNss
(writeScriptBin "start-server" ''
#!${runtimeShell}
nginx -c ${nginxConf};
'')
];
extraCommands = ''
mkdir -p var/log/nginx
mkdir -p var/cache/nginx
mkdir -p tmp
chmod 1777 tmp
'';
config = {
Cmd = ["start-server"];
ExposedPorts = {
"80/tcp" = {};
};
};
};
default = maps; default = maps;
}; };
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {