chore: add Dockerfile & ci for publishing dev images
parent
e5be439178
commit
86cd52a081
|
@ -2,3 +2,5 @@ target/
|
||||||
.git/
|
.git/
|
||||||
server/data/
|
server/data/
|
||||||
server/test.db/
|
server/test.db/
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
branches: [dev]
|
||||||
|
platform: 'linux/amd64'
|
||||||
|
depends_on:
|
||||||
|
- build
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
dev:
|
||||||
|
image: 'woodpeckerci/plugin-docker-buildx'
|
||||||
|
secrets:
|
||||||
|
- 'docker_username'
|
||||||
|
- 'docker_password'
|
||||||
|
settings:
|
||||||
|
registry: 'git.rustybever.be'
|
||||||
|
repo: 'git.rustybever.be/chewing_bever/rieter'
|
||||||
|
tags:
|
||||||
|
- 'dev'
|
||||||
|
platforms: [ 'linux/amd64' ]
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
|
branch: dev
|
33
Dockerfile
33
Dockerfile
|
@ -4,21 +4,6 @@ ARG DI_VER=1.2.5
|
||||||
|
|
||||||
WORKDIR /app
|
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 \
|
RUN apk add --no-cache \
|
||||||
build-base \
|
build-base \
|
||||||
curl \
|
curl \
|
||||||
|
@ -42,23 +27,29 @@ COPY . .
|
||||||
# LIBARCHIVE_LDFLAGS='-lssl -lcrypto -L/lib -lz -lbz2 -llzma -lexpat -lzstd -llz4'
|
# LIBARCHIVE_LDFLAGS='-lssl -lcrypto -L/lib -lz -lbz2 -llzma -lexpat -lzstd -llz4'
|
||||||
# LIBARCHIVE_LDFLAGS='-L/usr/lib -lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3'
|
# LIBARCHIVE_LDFLAGS='-L/usr/lib -lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3'
|
||||||
|
|
||||||
|
# https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172
|
||||||
|
ENV RUSTFLAGS='-C target-feature=-crt-static'
|
||||||
|
|
||||||
RUN cargo build --release && \
|
RUN cargo build --release && \
|
||||||
du -h target/release/rieterd && \
|
du -h target/release/rieterd && \
|
||||||
readelf -d target/release/rieterd && \
|
readelf -d target/release/rieterd && \
|
||||||
chmod +x 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
|
FROM alpine:3.18
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
libarchive
|
libgcc \
|
||||||
|
libarchive \
|
||||||
|
openssl
|
||||||
|
|
||||||
COPY --from=builder /app/dumb-init /bin/dumb-init
|
COPY --from=builder /app/dumb-init /bin/dumb-init
|
||||||
COPY --from=builder /app/target/debug/rieterd /bin/rieterd
|
COPY --from=builder /app/target/release/rieterd /bin/rieterd
|
||||||
|
|
||||||
|
ENV RIETER_PKG_DIR=/data/pkgs \
|
||||||
|
RIETER_DATA_DIR=/data
|
||||||
|
|
||||||
|
WORKDIR /data
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/dumb-init", "--"]
|
ENTRYPOINT ["/bin/dumb-init", "--"]
|
||||||
CMD ["/bin/rieterd"]
|
CMD ["/bin/rieterd"]
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
version: '3.4'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: 'rieterd:latest'
|
||||||
|
ports:
|
||||||
|
- '8000:8000'
|
||||||
|
environment:
|
||||||
|
- 'RIETER_API_KEY=test'
|
||||||
|
- 'RIETER_DATABASE_URL=postgres://rieter:rieter@db:5432/rieter'
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: 'postgres:15.3-alpine'
|
||||||
|
environment:
|
||||||
|
- 'POSTGRES_DB=rieter'
|
||||||
|
- 'POSTGRES_USER=rieter'
|
||||||
|
- 'POSTGRES_PASSWORD=rieter'
|
|
@ -15,24 +15,34 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
#[command(author, version, about, long_about = None)]
|
#[command(author, version, about, long_about = None)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
/// Directory where package archives will be stored
|
/// Directory where package archives will be stored
|
||||||
|
#[arg(env = "RIETER_PKG_DIR")]
|
||||||
pub pkg_dir: PathBuf,
|
pub pkg_dir: PathBuf,
|
||||||
/// Directory where repository metadata & SQLite database is stored
|
/// Directory where repository metadata & SQLite database is stored
|
||||||
|
#[arg(env = "RIETER_DATA_DIR")]
|
||||||
pub data_dir: PathBuf,
|
pub data_dir: PathBuf,
|
||||||
/// API key to authenticate private routes with
|
/// API key to authenticate private routes with
|
||||||
|
#[arg(env = "RIETER_API_KEY")]
|
||||||
pub api_key: String,
|
pub api_key: String,
|
||||||
|
|
||||||
/// Database connection URL; either sqlite:// or postgres://. Defaults to rieter.sqlite in the
|
/// Database connection URL; either sqlite:// or postgres://. Defaults to rieter.sqlite in the
|
||||||
/// data directory
|
/// data directory
|
||||||
#[arg(short, long)]
|
#[arg(short, long, env = "RIETER_DATABASE_URL")]
|
||||||
pub database_url: Option<String>,
|
pub database_url: Option<String>,
|
||||||
/// Port the server will listen on
|
/// Port the server will listen on
|
||||||
#[arg(short, long, value_name = "PORT", default_value_t = 8000)]
|
#[arg(
|
||||||
|
short,
|
||||||
|
long,
|
||||||
|
value_name = "PORT",
|
||||||
|
default_value_t = 8000,
|
||||||
|
env = "RIETER_PORT"
|
||||||
|
)]
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
/// Log levels for the tracing
|
/// Log levels for the tracing
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
value_name = "LOG_LEVEL",
|
value_name = "LOG_LEVEL",
|
||||||
default_value = "tower_http=debug,rieterd=debug"
|
default_value = "tower_http=debug,rieterd=debug",
|
||||||
|
env = "RIETER_LOG"
|
||||||
)]
|
)]
|
||||||
pub log: String,
|
pub log: String,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue