Merge pull request #1 from SunRed/master
Improve Dockerfile and include default environment file
This commit is contained in:
commit
243bc6397b
3 changed files with 26 additions and 19 deletions
33
Dockerfile
33
Dockerfile
|
@ -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
6
crablog.env
Normal file
|
@ -0,0 +1,6 @@
|
|||
SUBMIT_TOKEN=mysupersecretpw
|
||||
BIND_PORT=8000
|
||||
USERNAME=
|
||||
EMAIL=
|
||||
TWITTER_ACCOUNT=
|
||||
GITHUB_ACCOUNT=
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue