Skip to content

Commit 6f25ea9

Browse files
authored
ci: add manual docker release workflow (#7809)
1 parent cd41626 commit 6f25ea9

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Trigger this workflow only to manually create a Docker release; this should only be used
2+
# in extraordinary circumstances, as Docker releases are normally created automatically as
3+
# part of the automated release workflow.
4+
5+
name: release-manual-docker
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
ref:
10+
default: ''
11+
description: 'Reference (tag / SHA):'
12+
env:
13+
REGISTRY: docker.io
14+
IMAGE_NAME: parseplatform/parse-server
15+
jobs:
16+
build:
17+
runs-on: ubuntu-18.04
18+
permissions:
19+
contents: read
20+
packages: write
21+
steps:
22+
- name: Determine branch name
23+
id: branch
24+
run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}"
25+
- name: Checkout repository
26+
uses: actions/checkout@v2
27+
with:
28+
ref: ${{ github.event.inputs.ref }}
29+
- name: Set up QEMU
30+
id: qemu
31+
uses: docker/setup-qemu-action@v1
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v1
34+
- name: Log into Docker Hub
35+
if: github.event_name != 'pull_request'
36+
uses: docker/login-action@v1
37+
with:
38+
username: ${{ secrets.DOCKERHUB_USERNAME }}
39+
password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
- name: Extract Docker metadata
41+
id: meta
42+
uses: docker/metadata-action@v3
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
flavor: |
46+
latest=${{ steps.branch.outputs.branch_name == 'release' && github.event.inputs.ref == '' }}
47+
tags: |
48+
type=semver,enable=true,pattern={{version}},value=${{ github.event.inputs.ref }}
49+
type=raw,enable=${{ github.event.inputs.ref == '' }},value=latest
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@v2
52+
with:
53+
context: .
54+
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8
55+
push: ${{ github.event_name != 'pull_request' }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1+
############################################################
12
# Build stage
3+
############################################################
24
FROM node:lts-alpine as build
35

46
RUN apk update; \
57
apk add git;
68
WORKDIR /tmp
9+
10+
# Copy package.json first to benefit from layer caching
711
COPY package*.json ./
8-
RUN npm ci
12+
13+
# Copy src to have config files for install
914
COPY . .
15+
16+
# Clean npm cache; added to fix an issue with the install process
17+
RUN npm cache clean --force
18+
19+
# Install all dependencies
20+
RUN npm ci
21+
22+
# Run build steps
1023
RUN npm run build
1124

25+
############################################################
1226
# Release stage
27+
############################################################
1328
FROM node:lts-alpine as release
1429

1530
RUN apk update; \
@@ -21,6 +36,8 @@ WORKDIR /parse-server
2136

2237
COPY package*.json ./
2338

39+
# Clean npm cache; added to fix an issue with the install process
40+
RUN npm cache clean --force
2441
RUN npm ci --production --ignore-scripts
2542

2643
COPY bin bin

0 commit comments

Comments
 (0)