Merge pull request #1 from SunRed/master

Improve Dockerfile and include default environment file
This commit is contained in:
mtrx 2021-02-09 14:09:27 +01:00 committed by GitHub
commit 243bc6397b
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 19 deletions

View file

@ -1,18 +1,21 @@
FROM rustlang/rust:nightly
FROM rust:alpine as build
ENV RUSTFLAGS='-C target-feature=-crt-static'
WORKDIR /app
COPY ./site .
RUN apk add --no-cache musl-dev sqlite-dev
RUN cargo install --path .
FROM alpine:latest
COPY --from=build /usr/local/cargo/bin/crablog /app/crablog
WORKDIR /app
RUN apk add --no-cache libgcc sqlite-libs
ENV ROOT_PATH=/app/content
ENV DATABASE_URL=${ROOT_PATH}/db.sqlite3
EXPOSE 8000
ENV ROOT_PATH=/root/crablog/content
ENV DATABASE_URL=${ROOT_PATH}/db.sqlite3
RUN mkdir -p /root/crablog
COPY ./site /root/crablog
# set up database
WORKDIR /root/crablog
# install crablog
RUN cargo install --path . --root / -j $(nproc)
CMD ["crablog"]
CMD ["./crablog"]

6
crablog.env Normal file
View file

@ -0,0 +1,6 @@
SUBMIT_TOKEN=mysupersecretpw
BIND_PORT=8000
USERNAME=
EMAIL=
TWITTER_ACCOUNT=
GITHUB_ACCOUNT=

View file

@ -6,9 +6,7 @@ services:
- 8000:8000
hostname: crablog
container_name: crablog
env_file: .env
env_file: ./crablog.env
restart: unless-stopped
volumes:
- ./content:/root/crablog/content
volumes:
myapp:
- ./content:/app/content