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: update docker image #336

Merged
merged 6 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
36 changes: 36 additions & 0 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and test docker image
on:
pull_request:
paths:
- Dockerfile
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_docker_image:
name: Build docker image
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- run: sudo chown runner:docker /var/run/docker.sock
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build docker image
uses: docker/build-push-action@v5
with:
tags: oryd/sdk:${{ github.sha }}
push: false
outputs: type=docker,dest=./sdk.tar
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: oryd-sdk-${{ github.sha }}
path: ./sdk.tar
- name: run generate.sh and test.sh
run: |
docker load --input ./sdk.tar
rm ./sdk.tar
docker run --mount type=bind,source="$(pwd)",target=/project -e FORCE_PROJECT=client -e FORCE_VERSION=$(cat ./spec/client/latest) -i oryd/sdk:${{ github.sha }} /bin/sh -c "cd /project && ./scripts/generate.sh && ./scripts/test.sh"
27 changes: 9 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM openjdk:15-buster
# can't use bookworm (latest LTS as of June23) yet, as elixir/erlang does not provide packages for it yet. Check if https://binaries.erlang-solutions.com/debian/dists/bookworm/ is available to change this
FROM openjdk:21-bullseye

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates ssh bash

COPY scripts/build ./scripts

ENV GOLANG_VERSION 1.17

RUN set -eux; \
Expand Down Expand Up @@ -50,10 +53,10 @@ ENV GO111MODULE=on

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"

RUN curl -sL https://deb.nodesource.com/setup_15.x | bash - && apt-get install -y nodejs
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
# the following is a workaround for openjdk-11-jre-headless erroring due to not having a man path in slim-debian
RUN apt-get update -y
RUN apt-get install -y --no-install-recommends python3 python3-dev python3-pip ruby jq gnupg git gettext libffi6 libffi-dev libssl-dev php composer php-curl php7.3-tokenizer php-dom php-xml php-simplexml php-xmlwriter maven pkg-config
RUN apt-get install -y --no-install-recommends python3 python3-dev python3-pip ruby jq gnupg git gettext libffi-dev libssl-dev php composer php-curl php-dom php-xml php-simplexml php-xmlwriter maven pkg-config twine
# RUN apk add -U --no-cache ca-certificates bash nodejs npm python3 python3-dev py-pip ruby jq build-base gnupg git openssh curl gettext libffi libffi-dev openssl-dev php composer php-curl php7-tokenizer wget php-dom php-xml php-simplexml php-xmlwriter maven

# https://stackoverflow.com/questions/35736598/cannot-pip-install-cryptography-in-docker-alpine-linux-3-3-with-openssl-1-0-2g
Expand All @@ -72,8 +75,6 @@ RUN apt-get install -y --no-install-recommends python3 python3-dev python3-pip r
RUN npm install -g [email protected]
RUN npm i -g @openapitools/openapi-generator-cli
RUN openapi-generator-cli version-manager set 5.2.1
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --user --upgrade setuptools wheel twine

# dotnet
ENV PATH "$PATH:/root/.dotnet"
Expand All @@ -88,19 +89,10 @@ RUN apt-get install -y --no-install-recommends \
&& rm dotnet-install.sh

# dart
RUN \
apt-get -q update && apt-get install --no-install-recommends -y -q gnupg2 curl git ca-certificates apt-transport-https openssh-client && \
curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
apt-get update && \
apt-get install dart=2.19.6-1
RUN ./scripts/install-dart.sh

# elixir
RUN \
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && \
dpkg -i erlang-solutions_2.0_all.deb && \
apt-get -q update && apt-get install --no-install-recommends -y -q esl-erlang elixir && \
rm erlang-solutions_2.0_all.deb && \
RUN apt-get -q update && apt-get install -y -q elixir && \
mix local.hex --force

# rust
Expand All @@ -124,7 +116,7 @@ RUN td=$(mktemp) \

RUN gem install bundler -v 2.3.26 && \
apt-get update && \
apt-get install -y --no-install-recommends ruby-dev
apt-get install -y --no-install-recommends ruby-dev=1:2.7+2

ADD go.mod go.mod
ADD go.sum go.sum
Expand All @@ -133,4 +125,3 @@ RUN go build -o /usr/local/bin/ory github.com/ory/cli
RUN swagger version
RUN ory version

ENTRYPOINT /bin/bash
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ docker run --platform linux/amd64 --mount type=bind,source="$(pwd)",target=/proj

### Debugging Failing Tests on CI

If a tests fails on CI, you may run the following code snippet to reproduce the failure locally:
If a test fails in CI, you may run the following code snippet to reproduce the failure locally:

```shell script
docker run --platform linux/amd64 --mount type=bind,source="$(pwd)",target=/project --name sdk -it oryd/sdk:v0.0.51 /bin/sh
docker run --platform linux/amd64 --mount type=bind,source="$(pwd)",target=/project --name sdk -it oryd/sdk:v0.0.51 /bin/bash

export FORCE_VERSION=v1.2.17
export FORCE_PROJECT=client # or hydra or something else
export FORCE_VERSION=$(cat /project/spec/$FORCE_PROJECT/latest) # or a specific version, e.g. v1.2.17
cd /project

./scripts/generate.sh
Expand Down
27 changes: 27 additions & 0 deletions scripts/build/install-dart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -e

# Check the platform architecture
if [[ $(uname -m) == "x86_64" ]]; then
# Download the x64 Dart SDK
curl -L https://storage.googleapis.com/dart-archive/channels/stable/release/3.3.0/sdk/dartsdk-linux-x64-release.zip -o dart-sdk.zip
# Add your installation steps here
else
# Download the ARM Dart SDK
curl -L https://storage.googleapis.com/dart-archive/channels/stable/release/3.3.0/sdk/dartsdk-linux-arm64-release.zip -o dart-sdk.zip
# Add your installation steps here
fi

# Unzip the downloaded file
unzip dart-sdk.zip

# Remove the downloaded file
rm dart-sdk.zip

mkdir -p /usr/lib/dart
# Move the Dart SDK to the /usr/lib/dart directory
mv -v dart-sdk/* /usr/lib/dart

# Add the Dart SDK to the PATH
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.bashrc
Loading