Skip to content

Instantly share code, notes, and snippets.

@JulienBreux
Created August 19, 2019 15:37
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 JulienBreux/cad7faa92d4d3f912199fccb87ad1ca2 to your computer and use it in GitHub Desktop.
Save JulienBreux/cad7faa92d4d3f912199fccb87ad1ca2 to your computer and use it in GitHub Desktop.
Speed Nginx Docker (for tests)
FROM nginx:1-alpine
COPY ./src/index.html /usr/share/nginx/html
COPY ./etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Hello world!</title>
</head>
<body>
<h1>Hello world!</h1>
</body>
</html>
version: '2'
vars:
CONTAINER_NAME: nginx-tmp
tasks:
build:
deps: ["kill"]
cmds:
- docker build -t nginx:tmp .
run:
deps: ["build"]
cmds:
- docker run --rm -d -p 8080:80 --name {{.CONTAINER_NAME}} nginx:tmp
kill:
cmds:
- docker rm --force {{.CONTAINER_NAME}}
enter:
cmds:
- docker exec -it $(docker ps -q --filter name={{.CONTAINER_NAME}}) sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment