forked from genie-model/cgenie
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
43 lines (32 loc) · 1.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Use a multi-stage build to create a platform-independent image
FROM --platform=$BUILDPLATFORM continuumio/miniconda3:latest AS build
# Set build arguments
ARG TARGETPLATFORM
ARG BUILDPLATFORM
# Install necessary build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Create and activate the conda environment
RUN conda create --name myproject python=3.8 -y
SHELL ["conda", "run", "-n", "myproject", "/bin/bash", "-c"]
# Install netcdf-fortran using apt-get
RUN apt-get update && apt-get install -y --no-install-recommends \
libnetcdf-dev \
libnetcdff-dev \
&& rm -rf /var/lib/apt/lists/*
# Install scons and matplotlib using pip
RUN pip install --no-cache-dir scons matplotlib
# Clone the ctoaster.cupcake repository
RUN git clone https://github.com/derpycode/ctoaster.cupcake.git
WORKDIR /ctoaster.cupcake
# Create the final image
FROM continuumio/miniconda3:latest
# Copy the conda environment from the build stage
COPY --from=build /opt/conda/envs/myproject /opt/conda/envs/myproject
# Activate the conda environment
SHELL ["conda", "run", "-n", "myproject", "/bin/bash", "-c"]
# Copy the project files
COPY --from=build /ctoaster.cupcake /ctoaster.cupcake
WORKDIR /ctoaster.cupcake
# Set any necessary environment variables