Add the ability to run cpolis from docker

This commit is contained in:
Jason Streifling 2025-01-19 15:17:38 +01:00
parent 86a16629fd
commit 6885dfbb38
3 changed files with 35 additions and 2 deletions

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM golang:latest
RUN apk add --no-cache pandoc
WORKDIR /var/www/cpolis
COPY . .
RUN go build -o cpolis cmd/main.go
CMD ["./cpolis"]

View File

@ -51,8 +51,8 @@ func newConfig() *Config {
MaxImgWidth: 1920,
PDFDir: "/var/www/cpolis/pdfs",
PicsDir: "/var/www/cpolis/pics",
Port: ":8080",
Version: "v0.15.3",
Port: ":1664",
Version: "v0.16.0",
WebDir: "/var/www/cpolis/web",
}
}

22
docker-compose.yml Normal file
View File

@ -0,0 +1,22 @@
services:
app:
build: .
ports:
- "1664:1664"
volumes:
- /path/to/serviceAccountKey.json:/var/www/cpolis/serviceAccountKey.json
- /var/log/cpolis.log:/var/log/cpolis.log
depends_on:
- db
db:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: cpolis
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
ports:
- "3306:3306"
volumes:
- ./path/to/create_db.sql:/docker-entrypoint-initdb.d/create_db.sql