-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM neondatabase/build-tools:pinned | ||
|
||
ARG SCCACHE_VERSION=0.8.1 | ||
RUN cargo install sccache --version ${SCCACHE_VERSION} && \ | ||
rm -rf /home/nonroot/.cargo/registry && \ | ||
rm -rf /home/nonroot/.cargo/git | ||
ENV RUSTC_WRAPPER=sccache | ||
ENV SCCACHE_CACHE_SIZE="10G" | ||
ENV CC="/home/nonroot/.cargo/bin/sccache cc" | ||
ENV CXX="/home/nonroot/.cargo/bin/sccache c++" | ||
|
||
# USER root:root | ||
# RUN apt update && apt install sudo & \ | ||
# usermod -aG sudo nonroot && \ | ||
# echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ | ||
# usermod -aG nonroot nonroot && \ | ||
# rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
USER nonroot:nonroot | ||
WORKDIR /home/nonroot | ||
|
||
RUN git clone --recursive https://github.com/neondatabase/neon.git | ||
RUN cd neon && \ | ||
BUILD_TYPE=debug CARGO_BUILD_FLAGS='--features=testing' mold -run make -j$(nproc) | ||
RUN rm -f neon && dh -sh "/home/nonroot/.cache/sccache" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "Neon", | ||
"build": { | ||
// Sets the run context to one level up instead of the .devcontainer folder. | ||
"context": "..", | ||
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. | ||
"dockerfile": "Dockerfile.devcontainer" | ||
}, | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Uncomment the next line to run commands after the container is created. | ||
// "postCreateCommand": "./scripts/pysync", | ||
// "postCreateCommand": "BUILD_TYPE=debug CARGO_BUILD_FLAGS='--features=testing' mold -run make -s -j`nproc`", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"rust-lang.rust-analyzer" | ||
] | ||
} | ||
} | ||
|
||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "nonroot", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build build-tools image | ||
|
||
on: | ||
push: | ||
branches: | ||
- hackathon/devcontainer | ||
|
||
defaults: | ||
run: | ||
shell: bash -euo pipefail {0} | ||
|
||
# No permission for GITHUB_TOKEN by default; the **minimal required** set of permissions should be granted in each job. | ||
permissions: {} | ||
|
||
jobs: | ||
build-image: | ||
strategy: | ||
matrix: | ||
arch: [ x64, arm64 ] | ||
|
||
runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.arch == 'arm64' && 'large-arm64' || 'large')) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: ./.github/actions/set-docker-config-dir | ||
- uses: docker/setup-buildx-action@v3 | ||
with: | ||
cache-binary: false | ||
|
||
- uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }} | ||
|
||
- uses: docker/login-action@v3 | ||
with: | ||
registry: cache.neon.build | ||
username: ${{ secrets.NEON_CI_DOCKERCACHE_USERNAME }} | ||
password: ${{ secrets.NEON_CI_DOCKERCACHE_PASSWORD }} | ||
|
||
- name: Pre-build dev container image | ||
uses: devcontainers/ci@v0.3 | ||
with: | ||
imageName: neondatabase/neon-devcontainer | ||
imageTag: pinned-${{ matrix.arch }} | ||
push: always | ||
|
||
merge-images: | ||
needs: [ build-image ] | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }} | ||
|
||
- name: Create multi-arch image | ||
run: | | ||
docker buildx imagetools create -t neondatabase/neon-devcontainer:pinned \ | ||
neondatabase/neon-devcontainer:pinned-x64 \ | ||
neondatabase/neon-devcontainer:pinned-arm64 |