Skip to content

Commit

Permalink
chore: format dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kristof-mattei committed Feb 20, 2025
1 parent d876c00 commit edb1f30
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 16 deletions.
1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const prettierConfig = {
},
},
],
plugins: ["prettier-plugin-sh"],
};

module.exports = prettierConfig;
28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ FROM --platform=${BUILDPLATFORM} rust:1.84.1@sha256:738ae99a3d75623f41e6882566b4
ARG APPLICATION_NAME

RUN rm -f /etc/apt/apt.conf.d/docker-clean \
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

# borrowed (Ba Dum Tss!) from
# https://github.com/pablodeymo/rust-musl-builder/blob/7a7ea3e909b1ef00c177d9eeac32d8c9d7d6a08c/Dockerfile#L48-L49
RUN --mount=type=cache,id=apt-cache-amd64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-amd64,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get --no-install-recommends install --yes \
build-essential \
musl-dev \
musl-tools
apt-get update \
&& apt-get --no-install-recommends install --yes \
build-essential \
musl-dev \
musl-tools

FROM rust-base AS rust-linux-amd64
ARG TARGET=x86_64-unknown-linux-musl
Expand All @@ -22,11 +22,11 @@ FROM rust-base AS rust-linux-arm64
ARG TARGET=aarch64-unknown-linux-musl
RUN --mount=type=cache,id=apt-cache-arm64,from=rust-base,source=/var/cache/apt,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-arm64,from=rust-base,source=/var/lib/apt,target=/var/lib/apt,sharing=locked \
dpkg --add-architecture arm64 && \
apt-get update && \
apt-get --no-install-recommends install --yes \
libc6-dev-arm64-cross \
gcc-aarch64-linux-gnu
dpkg --add-architecture arm64 \
&& apt-get update \
&& apt-get --no-install-recommends install --yes \
libc6-dev-arm64-cross \
gcc-aarch64-linux-gnu

FROM rust-${TARGETPLATFORM//\//-} AS rust-cargo-build

Expand Down Expand Up @@ -65,9 +65,9 @@ RUN --mount=type=cache,target=/build/${APPLICATION_NAME}/target \

FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c AS passwd-build

RUN addgroup --gid 900 appgroup && \
# setting `--system` prevents prompting for a password
adduser --ingroup appgroup --uid 900 --system --shell /bin/false appuser
# setting `--system` prevents prompting for a password
RUN addgroup --gid 900 appgroup \
&& adduser --ingroup appgroup --uid 900 --system --shell /bin/false appuser

RUN cat /etc/group | grep appuser > /tmp/group_appuser
RUN cat /etc/passwd | grep appuser > /tmp/passwd_appuser
Expand Down
53 changes: 52 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"homepage": "https://github.com/kristof-mattei/rust-seed#readme",
"devDependencies": {
"@actions/tool-cache": "2.0.2",
"prettier": "3.5.1"
"prettier": "3.5.1",
"prettier-plugin-sh": "0.15.0"
},
"publishConfig": {
"access": "restricted"
Expand Down

0 comments on commit edb1f30

Please sign in to comment.