ci: add manual docker release workflow (#7809)
This commit is contained in:
57
.github/workflows/release-manual-docker.yml
vendored
Normal file
57
.github/workflows/release-manual-docker.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Trigger this workflow only to manually create a Docker release; this should only be used
|
||||||
|
# in extraordinary circumstances, as Docker releases are normally created automatically as
|
||||||
|
# part of the automated release workflow.
|
||||||
|
|
||||||
|
name: release-manual-docker
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
default: ''
|
||||||
|
description: 'Reference (tag / SHA):'
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: parseplatform/parse-server
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- name: Determine branch name
|
||||||
|
id: branch
|
||||||
|
run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}"
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.ref }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
id: qemu
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Log into Docker Hub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
flavor: |
|
||||||
|
latest=${{ steps.branch.outputs.branch_name == 'release' && github.event.inputs.ref == '' }}
|
||||||
|
tags: |
|
||||||
|
type=semver,enable=true,pattern={{version}},value=${{ github.event.inputs.ref }}
|
||||||
|
type=raw,enable=${{ github.event.inputs.ref == '' }},value=latest
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
19
Dockerfile
19
Dockerfile
@@ -1,15 +1,30 @@
|
|||||||
|
############################################################
|
||||||
# Build stage
|
# Build stage
|
||||||
|
############################################################
|
||||||
FROM node:lts-alpine as build
|
FROM node:lts-alpine as build
|
||||||
|
|
||||||
RUN apk update; \
|
RUN apk update; \
|
||||||
apk add git;
|
apk add git;
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
# Copy package.json first to benefit from layer caching
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
|
||||||
|
# Copy src to have config files for install
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Clean npm cache; added to fix an issue with the install process
|
||||||
|
RUN npm cache clean --force
|
||||||
|
|
||||||
|
# Install all dependencies
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Run build steps
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
############################################################
|
||||||
# Release stage
|
# Release stage
|
||||||
|
############################################################
|
||||||
FROM node:lts-alpine as release
|
FROM node:lts-alpine as release
|
||||||
|
|
||||||
RUN apk update; \
|
RUN apk update; \
|
||||||
@@ -21,6 +36,8 @@ WORKDIR /parse-server
|
|||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Clean npm cache; added to fix an issue with the install process
|
||||||
|
RUN npm cache clean --force
|
||||||
RUN npm ci --production --ignore-scripts
|
RUN npm ci --production --ignore-scripts
|
||||||
|
|
||||||
COPY bin bin
|
COPY bin bin
|
||||||
|
|||||||
Reference in New Issue
Block a user