Add docker

This commit is contained in:
Earlopain 2023-04-05 17:32:10 +02:00
parent 067b6c708e
commit 2ce17caac4
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
4 changed files with 37 additions and 6 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
.env
/target

View File

@ -1,7 +1,7 @@
SERVER_ADDR=
PG.USER=
PG.PASSWORD=
PG.HOST=
PG.PORT=
PG.DBNAME=
PG.POOL.MAX_SIZE=
PG__USER=
PG__PASSWORD=
PG__HOST=
PG__PORT=
PG__DBNAME=
PG__POOL__MAX_SIZE=

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM rust:1.68-alpine3.17 as builder
WORKDIR /app
RUN apk add --no-cache musl-dev
COPY . .
RUN CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo build --release
FROM alpine:3.17
COPY --from=builder /app/target/release/autocompleted /app/autocompleted

16
docker-compose.yml Normal file
View File

@ -0,0 +1,16 @@
version: '3'
services:
autocompleted:
restart: always
network_mode: host
command: /app/autocompleted
build: .
environment:
SERVER_ADDR: ${SERVER_ADDR}
PG__USER: ${PG__USER}
PG__PASSWORD: ${PG__PASSWORD}
PG__HOST: ${PG__HOST}
PG__PORT: ${PG__PORT}
PG__DBNAME: ${PG__DBNAME}
PG__POOL__MAX_SIZE: ${PG__POOL__MAX_SIZE}