Dockerize the app
This commit is contained in:
parent
4f01e2f5ce
commit
dbf82e213b
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
FROM golang:1.11-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apk add git && \
|
||||||
|
go get -u -v gitlab.com/pztrn/fastpastebin/cmd/fastpastebin
|
||||||
|
|
||||||
|
FROM alpine:3.10
|
||||||
|
LABEL maintainer "Stanislav N. <pztrn@pztrn.name>"
|
||||||
|
|
||||||
|
COPY --from=0 /go/bin/fastpastebin /app/fastpastebin
|
||||||
|
COPY examples/fastpastebin.yaml.docker /app/fastpastebin.yaml
|
||||||
|
|
||||||
|
EXPOSE 25544
|
||||||
|
ENTRYPOINT [ "/app/fastpastebin", "-config", "/app/fastpastebin.yaml" ]
|
37
docker-compose.yml
Normal file
37
docker-compose.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql:
|
||||||
|
|
||||||
|
services:
|
||||||
|
database:
|
||||||
|
image: mariadb:10.3
|
||||||
|
container_name: database
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- mysql:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
- MYSQL_RANDOM_ROOT_PASSWORD=yes
|
||||||
|
- MYSQL_DATABASE=fastpastebin
|
||||||
|
- MYSQL_USER=fastpastebin
|
||||||
|
- MYSQL_PASSWORD=fastpastebin
|
||||||
|
fastpastebin:
|
||||||
|
build: .
|
||||||
|
image: fastpastebin
|
||||||
|
container_name: fastpastebin
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
volumes:
|
||||||
|
- ./examples/fastpastebin.yaml.docker:/app/fastpastebin.yaml:ro
|
||||||
|
# ports:
|
||||||
|
# - 25544:25544
|
||||||
|
web:
|
||||||
|
image: nginx:1.16-alpine
|
||||||
|
container_name: nginx
|
||||||
|
volumes:
|
||||||
|
- ./examples/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
ports:
|
||||||
|
- 8080:80
|
||||||
|
depends_on:
|
||||||
|
- fastpastebin
|
22
examples/fastpastebin.yaml.docker
Normal file
22
examples/fastpastebin.yaml.docker
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
database:
|
||||||
|
type: "mysql"
|
||||||
|
path: "./data"
|
||||||
|
address: "database"
|
||||||
|
port: "3306"
|
||||||
|
username: "fastpastebin"
|
||||||
|
password: "fastpastebin"
|
||||||
|
database: "fastpastebin"
|
||||||
|
|
||||||
|
logging:
|
||||||
|
log_to_file: false
|
||||||
|
filename: ""
|
||||||
|
# Log level. Acceptable parameters: DEBUG, INFO, WARN, ERROR, FATAL, PANIC.
|
||||||
|
loglevel: "DEBUG"
|
||||||
|
|
||||||
|
http:
|
||||||
|
address: "0.0.0.0"
|
||||||
|
port: "25544"
|
||||||
|
allow_insecure: true
|
||||||
|
|
||||||
|
pastes:
|
||||||
|
pagination: 10
|
10
examples/nginx.conf
Normal file
10
examples/nginx.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
location / {
|
||||||
|
proxy_pass http://fastpastebin:25544;
|
||||||
|
proxy_set_header Host $Host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user