This repository has no description
6.0 kB
126 lines
1# syntax=docker/dockerfile:1
2FROM ubuntu:22.04 AS builder-no-darwin
3
4ARG TARGETARCH
5ENV TARGETARCH $TARGETARCH
6
7ARG DOCKERFILE_HASH
8ENV DOCKERFILE_HASH $DOCKERFILE_HASH
9
10# You'll probably need to bump golangci-lint if you bump go
11ENV GO_VERSION 1.26.5
12ENV GOLANGCI_LINT_VERSION 2.12.2
13ENV NODE_VERSION 22.15.0
14ENV DEBIAN_FRONTEND noninteractive
15
16ADD docker/sources.list /etc/apt/sources.list
17ADD docker/winehq.key /etc/apt/keyrings/winehq-archive.key
18ADD docker/llvm-snapshot.key /etc/apt/keyrings/llvm-snapshot.key
19
20RUN dpkg --add-architecture i386 && dpkg --add-architecture arm64
21
22# Haven't automated it yet, so here's my instructors for mirroring winehq:
23# /etc/apt/mirror.list:
24# deb-i386 https://dl.winehq.org/wine-builds/ubuntu jammy main
25# deb-all https://dl.winehq.org/wine-builds/ubuntu jammy main
26# deb-amd64 [arch=amd64,i386 signed-by=/etc/apt/keyrings/winehq-archive.key] https://dl.winehq.org/wine-builds/ubuntu jammy main
27#
28# go install github.com/minio/mc@latest
29# mc alias set streamplace-crap https://storage.googleapis.com/ ACCESS_KEY SECRET_KEY
30# apt-mirror
31# mc mirror --overwrite /var/spool/apt-mirror/mirror/dl.winehq.org/ streamplace-crap/streamplace-crap/dl.winehq.org/
32
33RUN apt update \
34 && apt install -y build-essential curl git openjdk-17-jdk unzip jq g++ python3-pip ninja-build \
35 gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user-static pkg-config \
36 nasm gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-tools zip bison flex expect \
37 mono-runtime nuget mono-xsp4 squashfs-tools \
38 libc6:arm64 libstdc++6:arm64 \
39 cmake libssl-dev libssl-dev:arm64 \
40 ruby-rubygems postgresql sudo \
41 && pip install meson tomli \
42 && curl -L --fail https://go.dev/dl/go$GO_VERSION.linux-$TARGETARCH.tar.gz -o go.tar.gz \
43 && tar -C /usr/local -xf go.tar.gz \
44 && rm go.tar.gz
45
46RUN echo 'deb [arch=amd64,i386 signed-by=/etc/apt/keyrings/winehq-archive.key] https://storage.googleapis.com/streamplace-crap/dl.winehq.org/wine-builds/ubuntu/ jammy main' >> /etc/apt/sources.list \
47 && echo 'deb [arch=amd64 signed-by=/etc/apt/keyrings/llvm-snapshot.key] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main' >> /etc/apt/sources.list \
48 && apt update \
49 && apt install -y --install-recommends winehq-stable \
50 clang-21 lldb-21 lld-21 clangd-21
51
52ENV PATH /usr/lib/llvm-21/bin:$PATH:/usr/local/go/bin:/root/go/bin:/root/.cargo/bin
53
54RUN export NODEARCH="$TARGETARCH" \
55 && if [ "$TARGETARCH" = "amd64" ]; then export NODEARCH="x64"; fi \
56 && curl -L --fail https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$NODEARCH.tar.xz -o node.tar.gz \
57 && tar -xf node.tar.gz \
58 && cp -r node-v$NODE_VERSION-linux-$NODEARCH/* /usr/local \
59 && rm -rf node.tar.gz node-v$NODE_VERSION-linux-$NODEARCH
60
61RUN npm install -g corepack@latest
62
63ARG ANDROID_SDK_VERSION=11076708
64ENV ANDROID_HOME /opt/android-sdk
65RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
66 curl -L -O https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip && \
67 unzip *tools*linux*.zip -d ${ANDROID_HOME}/cmdline-tools && \
68 mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/tools && \
69 rm *tools*linux*.zip && \
70 curl -L https://raw.githubusercontent.com/thyrlian/AndroidSDK/bfcbf0cdfd6bb1ef45579e6ddc4d3876264cbdd1/android-sdk/license_accepter.sh | bash
71
72RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh \
73 && bash rustup.sh -y \
74 && rustup target add aarch64-unknown-linux-gnu \
75 && rustup target add x86_64-unknown-linux-gnu \
76 && rustup target add x86_64-pc-windows-gnu \
77 && rustup target add x86_64-apple-darwin \
78 && rustup target add aarch64-apple-darwin \
79 && rustup target add wasm32-wasip1 \
80 && rustup target add wasm32-unknown-unknown \
81 && rm rustup.sh
82
83RUN go env -w GOTOOLCHAIN=go$GO_VERSION
84
85# FROM builder AS cached-builder
86# ARG CI_COMMIT_BRANCH=next
87# ENV CI_COMMIT_BRANCH $CI_COMMIT_BRANCH
88# WORKDIR /cached-build
89# RUN git clone https://git.stream.place/streamplace/streamplace \
90# && cd streamplace \
91# && make version install check app android -j$(nproc) \
92# && make node \
93# && cd .. \
94# && rm -rf streamplace
95
96RUN curl -L https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz -o golangci-lint.tar.gz \
97 && tar -xf golangci-lint.tar.gz \
98 && mv golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint /usr/local/bin/ \
99 && rm -rf golangci-lint.tar.gz golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64
100
101RUN gem install fpm
102ENV APTLY_VERSION 1.6.2
103RUN curl --fail -L https://github.com/aptly-dev/aptly/releases/download/v${APTLY_VERSION}/aptly_${APTLY_VERSION}_linux_amd64.zip -o aptly.zip \
104 && unzip aptly.zip \
105 && mv aptly_${APTLY_VERSION}_linux_amd64/aptly /usr/local/bin/ \
106 && rm -rf aptly.zip aptly_${APTLY_VERSION}_linux_amd64
107
108ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=false
109ENV STREAMPLACE_TEST_POSTGRES_COMMAND="install -d -o postgres -g postgres -m 3775 /var/run/postgresql/14-main.pg_stat_tmp && sudo -u postgres /usr/lib/postgresql/14/bin/postgres -D /etc/postgresql/14/main/"
110ENV STREAMPLACE_TEST_POSTGRES_URL="postgresql://postgres:postgres@localhost:5432/streamplace"
111# allow all postgres connections
112RUN bash -c 'echo -en "local all postgres peer\nhost all all 0.0.0.0/0 trust\n" > /etc/postgresql/14/main/pg_hba.conf'
113
114FROM builder-no-darwin AS builder
115
116WORKDIR /osxcross
117
118RUN git clone https://github.com/tpoechtrager/osxcross.git .
119# RUN UNATTENDED=1 ./build_apple_clang.sh
120ENV MAC_SDK_VERSION 15.4
121RUN curl -L --fail https://github.com/joseluisq/macosx-sdks/releases/download/$MAC_SDK_VERSION/MacOSX$MAC_SDK_VERSION.sdk.tar.xz -o /osxcross/tarballs/MacOSX$MAC_SDK_VERSION.sdk.tar.xz
122RUN UNATTENDED=1 ./build.sh
123RUN cargo install apple-codesign
124ENV PATH /osxcross/target/bin:$PATH
125
126LABEL org.opencontainers.image.authors="support@stream.place"