From 3b507910a0a9f9a84a7a48df70dfbc8034b07a2e Mon Sep 17 00:00:00 2001 From: ubergeek77 Date: Fri, 7 Jun 2024 15:07:00 -0500 Subject: [PATCH] 0.19.4 changes --- Dockerfile-backend | 11 +++++------ Dockerfile-frontend | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Dockerfile-backend b/Dockerfile-backend index e5fb6b6..491191b 100644 --- a/Dockerfile-backend +++ b/Dockerfile-backend @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.6 -ARG RUST_VERSION=1.76 +ARG RUST_VERSION=1.78 ARG CARGO_BUILD_FEATURES=default ARG RUST_RELEASE_MODE=release @@ -31,16 +31,15 @@ RUN --mount=type=cache,target=/lemmy/target set -ex; \ # Release build RUN --mount=type=cache,target=/lemmy/target set -ex; \ if [ "${RUST_RELEASE_MODE}" = "release" ]; then \ - echo "pub const VERSION: &str = \"$(git describe --tag)\";" > crates/utils/src/version.rs; \ - [ -z "$USE_RELEASE_CACHE" ] && cargo clean --release; \ + cargo clean --release; \ cargo build --features "${CARGO_BUILD_FEATURES}" --release; \ mv target/"${RUST_RELEASE_MODE}"/lemmy_server ./lemmy_server; \ fi FROM ${RUNNER_IMAGE} AS runner-linux -# Federation needs CA certificates -RUN apt update && apt install -y libssl-dev libpq-dev ca-certificates +# Add system packages that are needed: federation needs CA certificates, curl can be used for healthchecks +RUN apt update && apt install -y libssl-dev libpq-dev ca-certificates curl COPY --from=build --chmod=0755 /lemmy/lemmy_server /usr/local/bin @@ -54,4 +53,4 @@ USER $UNAME ENTRYPOINT ["lemmy_server"] EXPOSE 8536 -STOPSIGNAL SIGTERM +STOPSIGNAL SIGTERM \ No newline at end of file diff --git a/Dockerfile-frontend b/Dockerfile-frontend index 0b54157..815c69b 100644 --- a/Dockerfile-frontend +++ b/Dockerfile-frontend @@ -1,10 +1,13 @@ -FROM node:21-alpine as builder +FROM node:alpine as builder # Added vips-dev and pkgconfig so that local vips is used instead of prebuilt # Done for two reasons: # - libvips binaries are not available for ARM32 # - It can break depending on the CPU (https://github.com/LemmyNet/lemmy-ui/issues/1566) -RUN apk update && apk upgrade && apk add --no-cache curl yarn python3 build-base gcc wget git vips-dev pkgconfig +RUN apk update && apk upgrade && apk add --no-cache curl python3 build-base gcc wget git vips-dev pkgconfig + +# Enable corepack to use pnpm +RUN corepack enable # Install node-gyp RUN npm install -g node-gyp @@ -15,10 +18,8 @@ ENV npm_config_target_platform=linux ENV npm_config_target_libc=musl # Cache deps -COPY package.json yarn.lock ./ - -RUN yarn --production --prefer-offline --pure-lockfile --network-timeout 100000 - +COPY package.json pnpm-lock.yaml ./ +RUN pnpm i # Build COPY generate_translations.js \ tsconfig.json \ @@ -30,19 +31,19 @@ COPY lemmy-translations lemmy-translations COPY src src COPY .git .git -# Set UI version +# Set UI version RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts" +RUN echo "export const BUILD_DATE_ISO8601 = '$(date -u +"%Y-%m-%dT%H:%M:%SZ")';" > "src/shared/build-date.ts" -RUN yarn --production --prefer-offline --network-timeout 100000 -RUN yarn build:prod +RUN pnpm i +RUN pnpm prebuild:prod +RUN pnpm build:prod RUN rm -rf ./node_modules/import-sort-parser-typescript RUN rm -rf ./node_modules/typescript RUN rm -rf ./node_modules/npm -RUN du -sh ./node_modules/* | sort -nr | grep '\dM.*' - -FROM node:21-alpine as runner +FROM node:alpine as runner ENV NODE_ENV=production RUN apk update && apk add --no-cache curl vips-cpp && rm -rf /var/cache/apk/*