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

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

Merged
merged 6 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
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-slim as builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we specify a specific version to make use of the cache? I think 18-slim resolves to the latest version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest is actually 19 now.
https://hub.docker.com/_/node
Do you mean node:18.13-slim or specifying the sha256?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I meant the latest version of 18. I was actually thinking of something like 18.13.0-slim to have a very specific version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with that.
Can we get renovatebot to help us update it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the guy who wanted to do the pinning feature hasn't gotten to it yet.


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-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-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-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"
}
}