pkg docker
This commit is contained in:
parent
f5fdef9eef
commit
ea4c359b36
3 changed files with 53 additions and 0 deletions
7
.dockerignore
Normal file
7
.dockerignore
Normal file
|
@ -0,0 +1,7 @@
|
|||
/target
|
||||
tarpaulin-report.html
|
||||
.env
|
||||
cobertura.xml
|
||||
coverage/
|
||||
node_modules/
|
||||
/static/cache/bundle/*
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
FROM node:14.16.0 as frontend
|
||||
LABEL org.opencontainers.image.source https://github.com/mCaptcha/survey
|
||||
RUN apt-get update && apt-get install -y make
|
||||
COPY package.json yarn.lock /src/
|
||||
COPY vendor/ /src/vendor
|
||||
WORKDIR /src
|
||||
RUN yarn install
|
||||
COPY . .
|
||||
RUN make frontend
|
||||
|
||||
FROM rust:1.51.0-slim-buster as rust
|
||||
WORKDIR /src
|
||||
RUN apt-get update && apt-get install -y git
|
||||
COPY . /src
|
||||
COPY --from=frontend /src/static/cache/bundle /src/static/cache/bundle
|
||||
ENV RUST_BACKTRACE=1
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
RUN useradd -ms /bin/bash -u 1001 mcaptcha-survey
|
||||
WORKDIR /home/mcaptcha-survey
|
||||
COPY --from=rust /src/target/release/survey /usr/local/bin/
|
||||
COPY --from=rust /src/config/default.toml /etc/mcaptcha-survey/config.toml
|
||||
USER mcaptcha-survey
|
||||
CMD [ "/usr/local/bin/survey" ]
|
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
version: '3.9'
|
||||
|
||||
services:
|
||||
mcaptchas-survey:
|
||||
build: .
|
||||
ports:
|
||||
- 7000:7000
|
||||
environment:
|
||||
DATABASE_URL: postgres://postgres:password@postgres:5432/postgres # set password at placeholder
|
||||
RUST_LOG: debug
|
||||
|
||||
postgres:
|
||||
image: postgres:13.2
|
||||
volumes:
|
||||
- mcaptcha-survey-data:/var/lib/postgresql/
|
||||
environment:
|
||||
POSTGRES_PASSWORD: password # change password
|
||||
PGDATA: /var/lib/postgresql/data/mcaptcha/
|
||||
|
||||
volumes:
|
||||
mcaptcha-survey-data:
|
Loading…
Reference in a new issue