Skip to content

Commit

Permalink
Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
pycanis committed Sep 15, 2024
1 parent 8905e22 commit 2229c8e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
data
lnrecc.log
lnrecc.log
releases
16 changes: 1 addition & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
FROM rust:1.81-slim-bullseye AS build

RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev

WORKDIR /usr/src/app

COPY src src
COPY Cargo.toml .
COPY Cargo.lock .

RUN cargo build --release

FROM debian:bullseye-slim

RUN apt-get update && apt-get install -y \
Expand All @@ -32,6 +18,6 @@ RUN adduser \
&& chown -R appuser .
USER appuser

COPY --from=build /usr/src/app/target/release/lnrecc .
COPY --from=lnrecc-build /usr/src/app/target/release/lnrecc .

ENTRYPOINT ["lnrecc"]
13 changes: 13 additions & 0 deletions Dockerfile-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM rust:1.81-slim-bullseye AS build

RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev

WORKDIR /usr/src/app

COPY src src
COPY Cargo.toml .
COPY Cargo.lock .

RUN cargo build --release
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# ARM64 darwin
cargo build --release

APP_NAME="lnrecc"
VERSION="v1.0.0"
ARCHIVE_NAME="releases/${APP_NAME}-darwin-arm64-${VERSION}.tar.gz"

tar -czvf $ARCHIVE_NAME -C target/release $APP_NAME

# AMD64 linux

BUILD_IMAGE_NAME="lnrecc-build"
ARCHIVE_NAME="releases/${APP_NAME}-linux-amd64-${VERSION}.tar.gz"

docker build -f Dockerfile-build -t ${BUILD_IMAGE_NAME} --platform linux/amd64 .

container_id=$(docker run -d ${BUILD_IMAGE_NAME})

docker cp $container_id:/usr/src/app/target/release/$APP_NAME $APP_NAME

tar -czvf $ARCHIVE_NAME $APP_NAME

# cleanup

rm $APP_NAME
docker rm $container_id
docker rmi $BUILD_IMAGE_NAME

0 comments on commit 2229c8e

Please sign in to comment.