Skip to content

Instantly share code, notes, and snippets.

@darkn3rd
Created May 13, 2020 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkn3rd/1e8ec7e6f60c3e10c682e02f388f1de0 to your computer and use it in GitHub Desktop.
Save darkn3rd/1e8ec7e6f60c3e10c682e02f388f1de0 to your computer and use it in GitHub Desktop.
Windows Client Test

Windows Client Install Script Test

Prerequisite Tools

choco install virtualbox
choco install docker-toolbox

Configure Docker-Machine (Windows 10 Home)

docker-machine create --driver virtualbox dev
docker-machine env dev | Invoke-Expression

Nginx Config

user  www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;
  log_format    main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
  access_log    /var/log/nginx/access.log  main;
  sendfile      on;

  server {
      root /var/www;
      server_name localhost;
      location = / {
        try_files /getdgraph.sh =404;
      }

      location = /windows {
        try_files /getdgraph.ps1 =404;
      }

      location = /latest {
        try_files /latest-release.txt =404;
      }

      location ~ /.* {
        deny all;
      }
  }
}

Dockerfile

FROM nginx
RUN mkdir -p /var/www
COPY /some/path/getdgraph.sh /var/www
COPY /some/path/getdgraph.ps1 /var/www
ADD https://get.dgraph.io/latest /var/www/latest-release.txt
RUN chown -R www-data:www-data /var/www && chmod 755 /var/www/latest-release.txt
COPY nginx.conf /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/www

Build and Run

docker build -t dgraph-website .
docker run -d -p 80:80 dgraph-website

Clean

docker ps -q | ForEach-Object { docker stop $_ }
docker ps -aq | ForEach-Object { docker rm $_ }

Test

iwr http://$(docker-machine ip dev)/windows -useb | iex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment