mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 09:50:36 +01:00
Add Github Actions with Buildx for Docker publish
This commit is contained in:
parent
d51929a4b7
commit
a8c00f1ae7
53
.github/workflows/docker-release.yml
vendored
Normal file
53
.github/workflows/docker-release.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
name: Build docker images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?$'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: 'Release version'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Set up version
|
||||||
|
id: set-version
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event.inputs.version }}" != "" ]; then
|
||||||
|
VERSION=${{ github.event.inputs.version }}
|
||||||
|
elif [ "${{ github.ref_type }}" == "tag" ]; then
|
||||||
|
VERSION=${{ github.ref_name }}
|
||||||
|
else
|
||||||
|
echo "No version provided and no tag found."
|
||||||
|
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:${{ env.VERSION }}
|
@ -1,7 +1,6 @@
|
|||||||
# ---------------
|
ARG BASE_DISTRO="node:alpine"
|
||||||
# Install Dependencies
|
|
||||||
# ---------------
|
FROM --platform=${BUILDPLATFORM} ${BASE_DISTRO} as builder
|
||||||
FROM node:18-alpine as builder
|
|
||||||
|
|
||||||
WORKDIR /RTL
|
WORKDIR /RTL
|
||||||
|
|
||||||
@ -10,9 +9,6 @@ COPY package-lock.json /RTL/package-lock.json
|
|||||||
|
|
||||||
RUN npm install --legacy-peer-deps
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
# ---------------
|
|
||||||
# Build App
|
|
||||||
# ---------------
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the Angular application
|
# Build the Angular application
|
||||||
@ -24,15 +20,12 @@ RUN npm run buildbackend
|
|||||||
# Remove non production necessary modules
|
# Remove non production necessary modules
|
||||||
RUN npm prune --omit=dev --legacy-peer-deps
|
RUN npm prune --omit=dev --legacy-peer-deps
|
||||||
|
|
||||||
# ---------------
|
FROM --platform=$BUILDPLATFORM ${BASE_DISTRO} as runner
|
||||||
# Release App
|
|
||||||
# ---------------
|
|
||||||
FROM node:18-alpine as runner
|
|
||||||
|
|
||||||
WORKDIR /RTL
|
|
||||||
|
|
||||||
RUN apk add --no-cache tini
|
RUN apk add --no-cache tini
|
||||||
|
|
||||||
|
WORKDIR /RTL
|
||||||
|
|
||||||
COPY --from=builder /RTL/rtl.js ./rtl.js
|
COPY --from=builder /RTL/rtl.js ./rtl.js
|
||||||
COPY --from=builder /RTL/package.json ./package.json
|
COPY --from=builder /RTL/package.json ./package.json
|
||||||
COPY --from=builder /RTL/frontend ./frontend
|
COPY --from=builder /RTL/frontend ./frontend
|
@ -1,49 +0,0 @@
|
|||||||
# ---------------
|
|
||||||
# Install Dependencies
|
|
||||||
# ---------------
|
|
||||||
FROM node:18-alpine as builder
|
|
||||||
|
|
||||||
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 package.json /RTL/package.json
|
|
||||||
COPY package-lock.json /RTL/package-lock.json
|
|
||||||
|
|
||||||
RUN npm install --legacy-peer-deps
|
|
||||||
|
|
||||||
# ---------------
|
|
||||||
# Build App
|
|
||||||
# ---------------
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Build the Angular application
|
|
||||||
RUN npm run buildfrontend
|
|
||||||
|
|
||||||
# Build the Backend from typescript server
|
|
||||||
RUN npm run buildbackend
|
|
||||||
|
|
||||||
# Remove non production necessary modules
|
|
||||||
RUN npm prune --omit=dev --legacy-peer-deps
|
|
||||||
|
|
||||||
# ---------------
|
|
||||||
# Release App
|
|
||||||
# ---------------
|
|
||||||
FROM arm32v7/node:18-alpine as runner
|
|
||||||
|
|
||||||
WORKDIR /RTL
|
|
||||||
|
|
||||||
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
|
|
||||||
COPY --from=builder "/tini" /sbin/tini
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "-g", "--"]
|
|
||||||
|
|
||||||
CMD ["node", "rtl"]
|
|
@ -1,48 +0,0 @@
|
|||||||
# ---------------
|
|
||||||
# Install Dependencies
|
|
||||||
# ---------------
|
|
||||||
FROM node:18-alpine as builder
|
|
||||||
|
|
||||||
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-arm64 /tini
|
|
||||||
RUN chmod +x /tini
|
|
||||||
|
|
||||||
WORKDIR /RTL
|
|
||||||
|
|
||||||
COPY package.json /RTL/package.json
|
|
||||||
COPY package-lock.json /RTL/package-lock.json
|
|
||||||
|
|
||||||
RUN npm install --legacy-peer-deps
|
|
||||||
|
|
||||||
# ---------------
|
|
||||||
# Build App
|
|
||||||
# ---------------
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Build the Angular application
|
|
||||||
RUN npm run buildfrontend
|
|
||||||
|
|
||||||
# Build the Backend from typescript server
|
|
||||||
RUN npm run buildbackend
|
|
||||||
|
|
||||||
# Remove non production necessary modules
|
|
||||||
RUN npm prune --omit=dev --legacy-peer-deps
|
|
||||||
|
|
||||||
# ---------------
|
|
||||||
# Release App
|
|
||||||
# ---------------
|
|
||||||
FROM arm64v8/node:18-alpine as runner
|
|
||||||
|
|
||||||
WORKDIR /RTL
|
|
||||||
|
|
||||||
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
|
|
||||||
COPY --from=builder "/tini" /sbin/tini
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "-g", "--"]
|
|
||||||
|
|
||||||
CMD ["node", "rtl"]
|
|
Loading…
Reference in New Issue
Block a user