From bdf0f560f20357a3b6e85819f7b42a2ec9310543 Mon Sep 17 00:00:00 2001 From: Edward Loveall Date: Tue, 10 Oct 2023 19:44:56 -0400 Subject: [PATCH] Add Docker.arm64 file Request from opnxng@tuta.io via the mailing list --- Dockerfile | 2 +- Dockerfile.arm64 | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.arm64 diff --git a/Dockerfile b/Dockerfile index cc2e430..e1d6ba9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY webpack.mix.js . COPY src ./src RUN yarn prod -FROM crystallang/crystal:1.5-alpine as lucky_build +FROM crystallang/crystal:1.8.1-alpine as lucky_build ENV SKIP_LUCKY_TASK_PRECOMPILATION="1" RUN apk add yaml-static WORKDIR /tmp_build diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 new file mode 100644 index 0000000..4ae3933 --- /dev/null +++ b/Dockerfile.arm64 @@ -0,0 +1,42 @@ +FROM node:16-alpine as node_build +WORKDIR /tmp_build + +COPY package.json . +COPY yarn.lock . +RUN yarn install --network-timeout 120000 --no-progress --frozen-lockfile + +COPY webpack.mix.js . +COPY src ./src +RUN yarn prod + +FROM alpine:3.18.4 AS lucky_build +RUN apk add --no-cache 'crystal=1.8.2-r0' shards sqlite-static yaml-static yaml-dev libxml2-dev zlib-static openssl-libs-static openssl-dev musl-dev +ENV SKIP_LUCKY_TASK_PRECOMPILATION="1" +RUN apk add yaml-static +WORKDIR /tmp_build +COPY shard.* ./ +RUN shards install --production +COPY . . +COPY --from=node_build /tmp_build/public/mix-manifest.json public/mix-manifest.json +RUN crystal build --static src/start_server.cr +RUN crystal build --static tasks.cr -o run_task + +FROM alpine + +ARG PUID=1000 +ARG PGID=1000 + +RUN addgroup -g ${PGID} -S lucky && \ + adduser -u ${PUID} -S lucky -G lucky +WORKDIR /home/lucky/app + +COPY --chown=lucky:lucky --from=node_build /tmp_build/public public +COPY --chown=lucky:lucky --from=lucky_build /tmp_build/start_server start_server +COPY --chown=lucky:lucky --from=lucky_build /tmp_build/run_task run_task +COPY --chown=lucky:lucky ./script/docker_entrypoint ./ + +RUN mkdir ./config +RUN chown -R lucky /home/lucky +USER lucky + +CMD ["/home/lucky/app/docker_entrypoint"]