Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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