Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions docker #1421

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ jobs:
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
shahanafarooqui/rtl:$VERSION
shahanafarooqui/rtl:${{ env.VERSION }}
57 changes: 9 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:18-alpine as base
ARG BASE_DISTRO="node:alpine"

FROM --platform=${BUILDPLATFORM} ${BASE_DISTRO} as builder

WORKDIR /RTL

Expand All @@ -18,58 +20,17 @@ RUN npm run buildbackend
# Remove non production necessary modules
RUN npm prune --omit=dev --legacy-peer-deps

FROM arm32v7/node:18-alpine as runner-arm32v7

ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel /tini
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel.asc /tini.asc
RUN chmod +x /tini

WORKDIR /RTL

COPY --from=base /RTL/rtl.js ./rtl.js
COPY --from=base /RTL/package.json ./package.json
COPY --from=base /RTL/frontend ./frontend
COPY --from=base /RTL/backend ./backend
COPY --from=base /RTL/node_modules/ ./node_modules
COPY --from=base /tini /sbin/tini

EXPOSE 3000

ENTRYPOINT ["/sbin/tini", "-g", "--"]

CMD ["node", "rtl"]

FROM arm64v8/node:18-alpine as runner-arm64v8

ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-arm64 /tini
RUN chmod +x /tini

WORKDIR /RTL

COPY --from=base /RTL/rtl.js ./rtl.js
COPY --from=base /RTL/package.json ./package.json
COPY --from=base /RTL/frontend ./frontend
COPY --from=base /RTL/backend ./backend
COPY --from=base /RTL/node_modules/ ./node_modules
COPY --from=base /tini /sbin/tini

EXPOSE 3000

ENTRYPOINT ["/sbin/tini", "-g", "--"]

CMD ["node", "rtl"]

FROM node:18-alpine as runner-amd64
FROM --platform=$BUILDPLATFORM ${BASE_DISTRO} as runner

RUN apk add --no-cache tini

WORKDIR /RTL

COPY --from=base /RTL/rtl.js ./rtl.js
COPY --from=base /RTL/package.json ./package.json
COPY --from=base /RTL/frontend ./frontend
COPY --from=base /RTL/backend ./backend
COPY --from=base /RTL/node_modules/ ./node_modules
COPY --from=builder /RTL/rtl.js ./rtl.js
COPY --from=builder /RTL/package.json ./package.json
COPY --from=builder /RTL/frontend ./frontend
COPY --from=builder /RTL/backend ./backend
COPY --from=builder /RTL/node_modules/ ./node_modules

EXPOSE 3000

Expand Down
Loading
Loading