1
0
mirror of https://gitlab.com/Anson-Projects/projects.git synced 2025-06-16 06:56:46 +00:00

Add container for speedier development and builds

This commit is contained in:
Anson Biggs 2024-03-03 04:17:01 +00:00
parent 8cba29090e
commit 46e0190668
4 changed files with 40 additions and 43 deletions

View File

@ -1,21 +0,0 @@
FROM ghcr.io/quarto-dev/quarto-full:1.5.22
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
&& apt-get -y install git iproute2 procps lsb-release \
&& apt-get -y install python3 python3-pip \
&& apt-get -y install r-base \
&& apt-get -y install julia
RUN python3 -m pip install jupyter
# https://discourse.julialang.org/t/how-to-install-all-packages-in-a-project-into-the-general-julia-manifest/84143
# RUN julia -e "using Pkg; Pkg.instantiate()"
# COPY Project.toml /root/.julia/environments/v1.4/Project.toml
# COPY Manifest.toml /root/.julia/environments/v1.4/Manifest.toml
# RUN julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"
# # RUN quarto serve

View File

@ -1,15 +1,14 @@
{ {
"name": "Anson's Projects", "name": "Anson's Projects",
"build":{ "image": "registry.gitlab.com/anson-projects/projects:latest",
"dockerfile": "Dockerfile"
},
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [
"quarto.quarto", "quarto.quarto",
"julialang.language-julia" "julialang.language-julia",
"redhat.vscode-yaml",
"ms-azuretools.vscode-docker"
] ]
} }
} }
// "postCreateCommand": "julia -e 'import Pkg; Pkg.activate(\".\"); Pkg.instantiate()'"
} }

View File

@ -1,25 +1,27 @@
image: ghcr.io/quarto-dev/quarto-full:1.5.22
stages: stages:
- build - build
- deploy - deploy
build_project: build:master:
stage: build stage: build
image:
name: gcr.io/kaniko-project/executor:v1.21.0-debug
entrypoint: [""]
script: script:
- apt-get update - /kaniko/executor
- apt-get -y install --no-install-recommends apt-utils dialog 2>&1 --context "${CI_PROJECT_DIR}"
- apt-get -y install git iproute2 procps lsb-release --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
- apt-get -y install python3 python3-pip --destination "${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
- apt-get -y install r-base --destination "${CI_REGISTRY_IMAGE}:latest"
- apt-get -y install julia rules:
- python3 -m pip install jupyter - if: '$CI_COMMIT_BRANCH == "master"'
- julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"
- cp Project.toml /root/.julia/environments/v1.4/Project.toml render-quarto:
- cp Manifest.toml /root/.julia/environments/v1.4/Manifest.toml stage: deploy
- julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()" image: ${CI_REGISTRY_IMAGE}:latest
- echo "Building the project with Quarto..." script:
- quarto render --to html --output-dir public - echo "Building the project with Quarto..."
- quarto render --to html --output-dir public
artifacts: artifacts:
paths: paths:
- public - public
@ -29,7 +31,7 @@ pages:
script: script:
- echo "Publishing site..." - echo "Publishing site..."
dependencies: dependencies:
- build_project - render-quarto
artifacts: artifacts:
paths: paths:
- public - public

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM ghcr.io/quarto-dev/quarto-full:1.5.22
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils dialog \
git iproute2 procps lsb-release \
python3 python3-pip \
r-base \
julia \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install jupyter
# Assuming Project.toml and Manifest.toml are copied to the correct locations
COPY Project.toml /root/.julia/environments/v1.4/
COPY Manifest.toml /root/.julia/environments/v1.4/
RUN julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"