Last active
June 14, 2022 16:17
-
-
Save shikanime/3be46cebaa58881f1506dbe292c809fb to your computer and use it in GitHub Desktop.
Extreme minimalist Docker for Strapi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:14-bullseye-slim AS runtime | |
# Set the working directory | |
WORKDIR /usr/src/unicorn | |
# Define the build environment | |
ENV NODE_ENV production | |
# Copy the application dependencies | |
COPY package.json yarn.lock ./ | |
RUN yarn install --frozen-lockfile | |
FROM runtime AS release | |
# Build the application | |
COPY src src | |
COPY config config | |
COPY database database | |
COPY public public | |
COPY favicon.ico ./ | |
RUN yarn run build | |
FROM scratch | |
# ELF interpreter | |
COPY --from=runtime \ | |
/lib64/ld-linux-x86-64.so.2 \ | |
/lib64/ | |
# Runtime glibc | |
COPY --from=runtime \ | |
/lib/x86_64-linux-gnu \ | |
/lib/x86_64-linux-gnu | |
COPY --from=runtime \ | |
/usr/lib/x86_64-linux-gnu/libstdc++.so.6 \ | |
/usr/lib/x86_64-linux-gnu/ | |
# Shell script | |
COPY --from=runtime \ | |
/usr/bin/env \ | |
/usr/bin/ | |
# Node runtime | |
COPY --from=runtime \ | |
/usr/local/bin/node \ | |
/usr/bin/ | |
# Application artifacts | |
COPY --from=release \ | |
/usr/src/unicorn \ | |
/usr/src/unicorn | |
# Set the working directory | |
WORKDIR /usr/src/unicorn | |
# Define the run environment | |
ENV NODE_ENV production | |
ENTRYPOINT [ "/usr/src/unicorn/node_modules/.bin/strapi" ] | |
CMD [ "start" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment