Basic Docker support

This commit is contained in:
Raphaël Thériault 2020-08-11 23:25:50 -04:00
parent 5143d47a88
commit 4d9c4e050e
3 changed files with 50 additions and 1 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
target/
.vscode/
.idea/
filite.json
.env
*.db

41
Dockerfile Normal file
View File

@ -0,0 +1,41 @@
FROM rust:alpine AS build
RUN USER=root cargo new --bin filite
WORKDIR ./filite
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
RUN apk update \
&& apk add --no-cache make musl-dev perl \
&& rm -rf /var/cache/apk/*
RUN cargo build --release
RUN rm target/release/deps/filite*
COPY . ./
RUN cargo build --release
FROM alpine
ARG APP=/usr/src/app
ENV TZ=Etc/UTC \
APP_USER=appuser
RUN addgroup -S $APP_USER \
&& adduser -S -g $APP_USER $APP_USER
RUN apk update \
&& apk add --no-cache ca-certificates tzdata \
&& rm -rf /var/cache/apk/*
COPY --from=build /filite/target/release/filite ${APP}/filite
RUN chown -R $APP_USER:$APP_USER ${APP}
USER $APP_USER
WORKDIR ${APP}
CMD ["./filite"]

View File

@ -4,7 +4,7 @@
A flexible and standalone pastebin, URL shortener and file-sharing service that hosts **fi**les, redirects **li**nks and stores **te**xts.
[![GitHub Actions](https://img.shields.io/github/workflow/status/raftario/filite/Tests)](https://github.com/raftario/filite/actions?workflowID=Tests)
[![GitHub Actions](https://img.shields.io/github/workflow/status/raftario/filite/Tests?label=tests)](https://github.com/raftario/filite/actions?workflowID=Tests)
[![Crates.io](https://img.shields.io/crates/v/filite.svg)](https://crates.io/crates/filite)
[Live Example](https://filite.raphaeltheriault.com) (file upload disabled and rate limited)