feat: start of server Dockerfile

repo-db
Jef Roosens 2023-07-31 22:19:56 +02:00
parent a3131b39b3
commit efc8114704
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 68 additions and 0 deletions

4
.dockerignore 100644
View File

@ -0,0 +1,4 @@
target/
.git/
server/data/
server/test.db/

64
Dockerfile 100644
View File

@ -0,0 +1,64 @@
FROM rust:1.70-alpine3.18 AS builder
ARG DI_VER=1.2.5
WORKDIR /app
# RUN apk add --no-cache \
# build-base \
# curl \
# make \
# unzip \
# pkgconf \
# openssl openssl-libs-static openssl-dev \
# libarchive-static libarchive-dev \
# zlib-static zlib-dev \
# bzip2-static bzip2-dev \
# xz-static xz-dev \
# expat-static expat-dev \
# zstd-static zstd-dev \
# lz4-static lz4-dev \
# acl-static acl-dev
RUN apk add --no-cache \
build-base \
curl \
make \
unzip \
pkgconf \
libarchive libarchive-dev
# Build dumb-init
RUN curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \
cd "dumb-init-${DI_VER}" && \
make SHELL=/bin/sh && \
mv dumb-init .. && \
cd ..
COPY . .
# ENV LIBARCHIVE_STATIC=1 \
# LIBARCHIVE_LIB_DIR=/usr/lib \
# LIBARCHIVE_INCLUDE_DIR=/usr/include \
# LIBARCHIVE_LDFLAGS='-lssl -lcrypto -L/lib -lz -lbz2 -llzma -lexpat -lzstd -llz4'
# LIBARCHIVE_LDFLAGS='-L/usr/lib -lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3'
RUN cargo build --release && \
du -h target/release/rieterd && \
readelf -d target/release/rieterd && \
chmod +x target/release/rieterd
# [ "$(readelf -d target/debug/rieterd | grep NEEDED | wc -l)" = 0 ] && \
# chmod +x target/debug/rieterd
FROM alpine:3.18
WORKDIR /app
RUN apk add --no-cache \
libarchive
COPY --from=builder /app/dumb-init /bin/dumb-init
COPY --from=builder /app/target/debug/rieterd /bin/rieterd
ENTRYPOINT ["/bin/dumb-init", "--"]
CMD ["/bin/rieterd"]