Skip to content

Commit

Permalink
chore(docker): use node:18-slim base image (#728)
Browse files Browse the repository at this point in the history
* chore(ci): build Docker platforms separately

* chore(docker): use node:18-slim base image

Use latest pnpm version.
Remove Docker build action timeouts.

* chore(docs): update README setup instructions

* chore(ci): consolidate docker workflows

* chore(ci): exclude arm64 Docker builds for pull requests

* chore(docker): specify base image minor and patch version
  • Loading branch information
wilsonianb authored Jan 26, 2023
1 parent e518e2c commit 21d3fe4
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 83 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/docker-backend.yml

This file was deleted.

22 changes: 15 additions & 7 deletions .github/workflows/docker-auth.yml → .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@ on:
tags:
- '*'

name: Build / Release Auth Docker Image
name: Build / Release Docker Images

jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
matrix:
package: [auth, backend]
platform: [linux/amd64, linux/arm64]
push:
- ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
exclude:
- platform: linux/arm64
push: false
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/rafiki-auth
images: ghcr.io/${{ github.repository_owner }}/rafiki-${{ matrix.package }}
tags: |
type=raw,enable={{is_default_branch}},value=latest
type=raw,enable=true,value={{ sha }}
Expand All @@ -32,13 +40,13 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push auth
- name: Build and push
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
push: ${{ matrix.push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: packages/auth/Dockerfile
platforms: linux/amd64,linux/arm64
file: packages/${{ matrix.package }}/Dockerfile
platforms: ${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/lint_test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
backend:
runs-on: ubuntu-latest
needs: checkout
timeout-minutes: 15
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/rafiki/env-setup
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/rafiki/env-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,13 @@ description: "Sets node version, init pnpm, restore cache"
runs:
using: "composite"
steps:
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7.9.1
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
version: 7
- uses: actions/setup-node@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

node-version: '18'
cache: 'pnpm'
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ More phone numbers: https://tel.meet/rdx-xoqn-iiq?pin=3263008843276
### Environment Setup

```sh
# install node 16
nvm install lts/gallium
nvm use lts/gallium
# install node 18
nvm install lts/hydrogen
nvm use lts/hydrogen

# install pnpm
corepack enable
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "Apache-2.0",
"repository": "https://github.com/interledger/rafiki",
"engines": {
"node": "16 || 18"
"node": "18"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand Down
5 changes: 3 additions & 2 deletions packages/auth/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:16.17.1-slim as builder
FROM node:18.13.0-slim as builder

WORKDIR /workspace

RUN apt update
RUN apt install -y curl xz-utils python3 build-essential

# version in curl is not the version used. Dependent on the last command
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global [email protected]
RUN corepack enable
RUN corepack prepare [email protected] --activate

# pnpm fetch does require only lockfile
COPY pnpm-lock.yaml ./
Expand Down
5 changes: 3 additions & 2 deletions packages/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:16.17.1-slim as builder
FROM node:18.13.0-slim as builder

WORKDIR /workspace

RUN apt update
RUN apt install -y curl xz-utils python3 build-essential

# version in curl is not the version used. Dependent on the last command
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global [email protected]
RUN corepack enable
RUN corepack prepare [email protected] --activate

# pnpm fetch does require only lockfile
COPY pnpm-lock.yaml ./
Expand Down
5 changes: 3 additions & 2 deletions packages/http-signature-utils/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:16.17.1-slim as builder
FROM node:18.13.0-slim as builder

WORKDIR /workspace

RUN apt update
RUN apt install -y curl xz-utils python3 build-essential

# version in curl is not the version used. Dependent on the last command
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global [email protected]
RUN corepack enable
RUN corepack prepare [email protected] --activate

# pnpm fetch does require only lockfile
COPY pnpm-lock.yaml ./
Expand Down
5 changes: 3 additions & 2 deletions packages/mock-account-provider/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:16-slim as builder
FROM node:18.13.0-slim as builder

WORKDIR /workspace

RUN apt update
RUN apt install -y curl xz-utils python3 build-essential

# version in curl is not the version used. Dependent on the last command
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global [email protected]
RUN corepack enable
RUN corepack prepare [email protected] --activate

# pnpm fetch does require only lockfile
COPY pnpm-lock.yaml ./
Expand Down
2 changes: 1 addition & 1 deletion packages/mock-account-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"typescript": "^4.9.4"
},
"engines": {
"node": "16 || 18"
"node": "18"
}
}

0 comments on commit 21d3fe4

Please sign in to comment.