mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 14:21:19 +00:00
Upgrade to rasky lemmy-arm v0.2.0
This commit is contained in:
parent
796b368cbc
commit
4499170fb8
2 changed files with 45 additions and 45 deletions
|
@ -248,7 +248,7 @@ steps:
|
||||||
settings:
|
settings:
|
||||||
repo: dessalines/lemmy
|
repo: dessalines/lemmy
|
||||||
dockerfile: docker/Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64, linux/arm64
|
||||||
build_args:
|
build_args:
|
||||||
- RUST_RELEASE_MODE=release
|
- RUST_RELEASE_MODE=release
|
||||||
tag: ${CI_COMMIT_TAG}
|
tag: ${CI_COMMIT_TAG}
|
||||||
|
|
|
@ -4,7 +4,7 @@ ARG CARGO_BUILD_FEATURES=default
|
||||||
ARG RUST_RELEASE_MODE=debug
|
ARG RUST_RELEASE_MODE=debug
|
||||||
|
|
||||||
ARG AMD_BUILDER_IMAGE=rust:${RUST_VERSION}
|
ARG AMD_BUILDER_IMAGE=rust:${RUST_VERSION}
|
||||||
ARG ARM_BUILDER_IMAGE="ghcr.io/raskyld/aarch64-lemmy-linux-gnu:v0.1.0"
|
ARG ARM_BUILDER_IMAGE="ghcr.io/raskyld/aarch64-lemmy-linux-gnu:v0.2.0"
|
||||||
|
|
||||||
ARG AMD_RUNNER_IMAGE=debian:bookworm-slim
|
ARG AMD_RUNNER_IMAGE=debian:bookworm-slim
|
||||||
ARG ARM_RUNNER_IMAGE=debian:bookworm-slim
|
ARG ARM_RUNNER_IMAGE=debian:bookworm-slim
|
||||||
|
@ -41,38 +41,38 @@ RUN --mount=type=cache,target=/lemmy/target set -ex; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ARM64 builder
|
# ARM64 builder
|
||||||
# # NB(raskyld): this is a hack to be able to COPY --from= this image, because the variable doesn't
|
# NB(raskyld): this is a hack to be able to COPY --from= this image, because the variable doesn't
|
||||||
# seem to be expended in --form arg of COPY :(
|
# seem to be expended in --form arg of COPY :(
|
||||||
# FROM --platform=linux/amd64 ${ARM_BUILDER_IMAGE} AS build-arm64
|
FROM --platform=linux/amd64 ${ARM_BUILDER_IMAGE} AS build-arm64
|
||||||
|
|
||||||
# ARG RUST_RELEASE_MODE
|
ARG RUST_RELEASE_MODE
|
||||||
# ARG CARGO_BUILD_FEATURES
|
ARG CARGO_BUILD_FEATURES
|
||||||
|
|
||||||
# WORKDIR /home/lemmy/src
|
WORKDIR /home/lemmy/src
|
||||||
# USER 10001:10001
|
USER 10001:10001
|
||||||
|
|
||||||
# COPY --chown=lemmy:lemmy . ./
|
COPY --chown=lemmy:lemmy . ./
|
||||||
|
|
||||||
# ENV PATH="/home/lemmy/.cargo/bin:${PATH}"
|
ENV PATH="/home/lemmy/.cargo/bin:${PATH}"
|
||||||
# ENV RUST_RELEASE_MODE=${RUST_RELEASE_MODE} \
|
ENV RUST_RELEASE_MODE=${RUST_RELEASE_MODE} \
|
||||||
# CARGO_BUILD_FEATURES=${CARGO_BUILD_FEATURES}
|
CARGO_BUILD_FEATURES=${CARGO_BUILD_FEATURES}
|
||||||
|
|
||||||
# # Debug build
|
# Debug build
|
||||||
# RUN --mount=type=cache,target=./target,uid=10001,gid=10001 set -ex; \
|
RUN --mount=type=cache,target=./target,uid=10001,gid=10001 set -ex; \
|
||||||
# if [ "${RUST_RELEASE_MODE}" = "debug" ]; then \
|
if [ "${RUST_RELEASE_MODE}" = "debug" ]; then \
|
||||||
# echo "pub const VERSION: &str = \"$(git describe --tag)\";" > crates/utils/src/version.rs; \
|
echo "pub const VERSION: &str = \"$(git describe --tag)\";" > crates/utils/src/version.rs; \
|
||||||
# cargo build --features "${CARGO_BUILD_FEATURES}"; \
|
cargo build --features "${CARGO_BUILD_FEATURES}"; \
|
||||||
# mv "./target/$CARGO_BUILD_TARGET/$RUST_RELEASE_MODE/lemmy_server" /home/lemmy/lemmy_server; \
|
mv "./target/$CARGO_BUILD_TARGET/$RUST_RELEASE_MODE/lemmy_server" /home/lemmy/lemmy_server; \
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# # Release build
|
# Release build
|
||||||
# RUN --mount=type=cache,target=./target,uid=10001,gid=10001 set -ex; \
|
RUN --mount=type=cache,target=./target,uid=10001,gid=10001 set -ex; \
|
||||||
# if [ "${RUST_RELEASE_MODE}" = "release" ]; then \
|
if [ "${RUST_RELEASE_MODE}" = "release" ]; then \
|
||||||
# echo "pub const VERSION: &str = \"$(git describe --tag)\";" > crates/utils/src/version.rs; \
|
echo "pub const VERSION: &str = \"$(git describe --tag)\";" > crates/utils/src/version.rs; \
|
||||||
# [ -z "$USE_RELEASE_CACHE" ] && cargo clean --release; \
|
[ -z "$USE_RELEASE_CACHE" ] && cargo clean --release; \
|
||||||
# cargo build --features "${CARGO_BUILD_FEATURES}" --release; \
|
cargo build --features "${CARGO_BUILD_FEATURES}" --release; \
|
||||||
# mv "./target/$CARGO_BUILD_TARGET/$RUST_RELEASE_MODE/lemmy_server" /home/lemmy/lemmy_server; \
|
mv "./target/$CARGO_BUILD_TARGET/$RUST_RELEASE_MODE/lemmy_server" /home/lemmy/lemmy_server; \
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# amd64 base runner
|
# amd64 base runner
|
||||||
FROM ${AMD_RUNNER_IMAGE} AS runner-linux-amd64
|
FROM ${AMD_RUNNER_IMAGE} AS runner-linux-amd64
|
||||||
|
@ -83,28 +83,28 @@ RUN apt update && apt install -y libssl-dev libpq-dev ca-certificates
|
||||||
COPY --from=build-amd64 --chmod=0755 /lemmy/lemmy_server /usr/local/bin
|
COPY --from=build-amd64 --chmod=0755 /lemmy/lemmy_server /usr/local/bin
|
||||||
|
|
||||||
# arm base runner
|
# arm base runner
|
||||||
# FROM ${ARM_RUNNER_IMAGE} AS runner-linux-arm64
|
FROM ${ARM_RUNNER_IMAGE} AS runner-linux-arm64
|
||||||
|
|
||||||
# RUN apt update && apt install -y ca-certificates libssl-dev libpq-dev
|
RUN apt update && apt install -y ca-certificates libssl-dev libpq-dev
|
||||||
|
|
||||||
# COPY --from=build-arm64 --chmod=0755 /home/lemmy/lemmy_server /usr/local/bin
|
COPY --from=build-arm64 --chmod=0755 /home/lemmy/lemmy_server /usr/local/bin
|
||||||
|
|
||||||
# # Final image that use a base runner based on the target OS and ARCH
|
# Final image that use a base runner based on the target OS and ARCH
|
||||||
# FROM runner-${TARGETOS}-${TARGETARCH}
|
FROM runner-${TARGETOS}-${TARGETARCH}
|
||||||
|
|
||||||
# LABEL org.opencontainers.image.authors="The Lemmy Authors"
|
LABEL org.opencontainers.image.authors="The Lemmy Authors"
|
||||||
# LABEL org.opencontainers.image.source="https://github.com/LemmyNet/lemmy"
|
LABEL org.opencontainers.image.source="https://github.com/LemmyNet/lemmy"
|
||||||
# LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"
|
LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"
|
||||||
# LABEL org.opencontainers.image.description="A link aggregator and forum for the fediverse"
|
LABEL org.opencontainers.image.description="A link aggregator and forum for the fediverse"
|
||||||
|
|
||||||
# ARG UNAME
|
ARG UNAME
|
||||||
# ARG GID
|
ARG GID
|
||||||
# ARG UID
|
ARG UID
|
||||||
|
|
||||||
# RUN groupadd -g ${GID} -o ${UNAME} && \
|
RUN groupadd -g ${GID} -o ${UNAME} && \
|
||||||
# useradd -m -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
|
useradd -m -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
|
||||||
# USER $UNAME
|
USER $UNAME
|
||||||
|
|
||||||
# ENTRYPOINT ["lemmy_server"]
|
ENTRYPOINT ["lemmy_server"]
|
||||||
# EXPOSE 8536
|
EXPOSE 8536
|
||||||
# STOPSIGNAL SIGTERM
|
STOPSIGNAL SIGTERM
|
||||||
|
|
Loading…
Reference in a new issue