Skip to content

Instantly share code, notes, and snippets.

@carlosedp
Last active April 17, 2023 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosedp/1f9119e0645e842e474ec1a67b5aed7e to your computer and use it in GitHub Desktop.
Save carlosedp/1f9119e0645e842e474ec1a67b5aed7e to your computer and use it in GitHub Desktop.
Symbiflow Docker image
#!/bin/bash
source "/opt/conda/etc/profile.d/conda.sh"
exec "$@"
FROM continuumio/miniconda
ENV INSTALL_DIR="/opt/symbiflow"
ENV FPGA_FAM=xc7
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y ca-certificates git build-essential wget cmake xz-utils --no-install-recommends
RUN git clone https://github.com/SymbiFlow/symbiflow-examples
RUN cd symbiflow-examples && \
conda env create -f ./${FPGA_FAM}/environment.yml
RUN mkdir -p ${INSTALL_DIR}/${FPGA_FAM}/install && \
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-install-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7a50t_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7a100t_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7a200t_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7z010_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install
ENV PATH="$INSTALL_DIR/$FPGA_FAM/install/bin:/opt/conda/envs/${FPGA_FAM}/bin/:${PATH}"
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bash"]
@mithro
Copy link

mithro commented Apr 15, 2021

Your docker file is missing the following bits;

Next, prepare the environment:

export PATH="$INSTALL_DIR/$FPGA_FAM/install/bin:$PATH";
source "$INSTALL_DIR/$FPGA_FAM/conda/etc/profile.d/conda.sh"

Finally, enter your working Conda environment:

conda activate $FPGA_FAM

I'm unclear how you make that persistent in Docker.

@mithro
Copy link

mithro commented Apr 15, 2021

It looks like the continuumio/miniconda3 docker image does some "interesting" things to try and activate the environment;
https://github.com/ContinuumIO/docker-images/blob/f145ec86a6543fa28812d5ed947edf3443d8a88a/miniconda3/alpine/Dockerfile#L66-L73

@carlosedp
Copy link
Author

There it goes, with a docker-entrypoint it works fine!

@goobncl
Copy link

goobncl commented Apr 17, 2023

#!/bin/bash

# Set environment variables
export PATH="$INSTALL_DIR/$FPGA_FAM/install/bin:$PATH";
source "$INSTALL_DIR/$FPGA_FAM/conda/etc/profile.d/conda.sh"
conda activate $FPGA_FAM

# Run CMD
exec "$@"
FROM continuumio/miniconda

ENV INSTALL_DIR="/opt/symbiflow"
ENV FPGA_FAM=xc7

RUN echo "deb http://deb.debian.org/debian oldstable main" > /etc/apt/sources.list && \
    echo "deb http://security.debian.org/debian-security oldstable/updates main" >> /etc/apt/sources.list && \
    echo "deb http://deb.debian.org/debian oldstable-updates main" >> /etc/apt/sources.list && \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y ca-certificates git build-essential wget cmake xz-utils --no-install-recommends && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*


RUN git clone https://github.com/SymbiFlow/symbiflow-examples

RUN cd symbiflow-examples && \
    conda env create -f ./${FPGA_FAM}/environment.yml

RUN mkdir -p ${INSTALL_DIR}/${FPGA_FAM}/install && \
    wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-install-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
    wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7a50t_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
    wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7a100t_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
    wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7a200t_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install && \
    wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/201/20210325-000253/symbiflow-arch-defs-xc7z010_test-1c7a3d1e.tar.xz | tar -xJC ${INSTALL_DIR}/${FPGA_FAM}/install

COPY ./docker-entrypoint.sh /

ENTRYPOINT ["/docker-entrypoint.sh"]

# Set environment variables
ENV PATH="$INSTALL_DIR/$FPGA_FAM/install/bin:$PATH"
ENV CONDA_DEFAULT_ENV=$FPGA_FAM

CMD ["bash", "-c", "source activate $FPGA_FAM && exec bash"]
C:\Users\User\Docker>docker build -t carlosedp/symbiflow -f Dockerfile.symbiflow .
[+] Building 36.3s (8/10)
 => [internal] load build definition from Dockerfile.symbiflow                                                                                                                                                                          0.0s
 => => transferring dockerfile: 2.39kB                                                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/continuumio/miniconda:latest                                                                                                                                                                 1.3s
 => [1/6] FROM docker.io/continuumio/miniconda@sha256:fee1354ae2435522b9a8a79c5f1c406facc07ec5c44d730d8053600b37c924f0                                                                                                                  0.0s
 => [internal] load build context                                                                                                                                                                                                       0.0s
 => => transferring context: 42B                                                                                                                                                                                                        0.0s
 => CACHED [2/6] RUN echo "deb http://deb.debian.org/debian oldstable main" > /etc/apt/sources.list &&     echo "deb http://security.debian.org/debian-security oldstable/updates main" >> /etc/apt/sources.list &&     echo "deb http  0.0s
 => CACHED [3/6] RUN git clone https://github.com/SymbiFlow/symbiflow-examples                                                                                                                                                          0.0s
 => ERROR [4/6] RUN cd symbiflow-examples &&     conda env create -f ./xc7/environment.yml                                                                                                                                             34.9s
------
 > [4/6] RUN cd symbiflow-examples &&     conda env create -f ./xc7/environment.yml:
#6 0.648 Collecting package metadata (repodata.json): ...working... done

#6 34.67 Found conflicts! Looking for incompatible packages.
#6 34.67 This can take several minutes.  Press CTRL-C to abort.
#6 34.67 failed
#6 34.67
#6 34.67 UnsatisfiableError: The following specifications were found to be incompatible with each other:
#6 34.67
#6 34.67
#6 34.67
#6 34.67 Package binutils-riscv64-elf conflicts for:
#6 34.67 litex-hub::gcc-riscv64-elf-newlib==10.1.0=20220706_160221 -> binutils-riscv64-elf
#6 34.67 Package libxml2 conflicts for:
#6 34.67 lxml -> libxml2[version='>=2.10.3,<2.11.0a0|>=2.9.10,<2.10.0a0|>=2.9.12,<2.10.0a0|>=2.9.14,<2.10.0a0,>=2.9.2,!=2.9.11,!=2.9.12|>=2.9.4,<2.10.0a0|>=2.9.7,<2.10.0a0|>=2.9.8,<2.10.0a0|>=2.9.9,<2.10.0a0']
#6 34.67 Package expat conflicts for:
#6 34.67 git -> expat[version='>=2.2.10,<3.0a0|>=2.2.5,<3.0a0|>=2.2.6,<3.0a0']
#6 34.67 Package sortedcontainers conflicts for:
#6 34.67 intervaltree -> sortedcontainers
#6 34.67 Package libftdi conflicts for:
#6 34.67 litex-hub::openfpgaloader==0.8.0_114_g057ce93=20220706_155948 -> libftdi
#6 34.67 Package libxslt conflicts for:
#6 34.67 lxml -> libxslt[version='>=1.1.28,<2.0.0a0,>=1.1.37,<2.0a0|>=1.1.28,>=1.1.34,<2.0a0|>=1.1.28,>=1.1.35,<2.0a0|>=1.1.32,<2.0a0|>=1.1.33,<2.0a0|>=1.1.34,<2.0a0']
#6 34.67 Package libstdcxx-ng conflicts for:
#6 34.67 litex-hub::symbiflow-yosys-plugins==1.0.0_7_1260_ge7070ca=20230225_164303 -> libstdcxx-ng[version='>=11.2.0']
#6 34.67 litex-hub::gcc-riscv64-elf-newlib==10.1.0=20220706_160221 -> libstdcxx-ng[version='>=11.2.0']
#6 34.67 litex-hub::vtr-optimized==8.0.0_5699_g25e723a24=20220708_203356 -> libstdcxx-ng[version='>=11.2.0']
#6 34.67 litex-hub::openfpgaloader==0.8.0_114_g057ce93=20220706_155948 -> libstdcxx-ng[version='>=11.2.0']
#6 34.67 litex-hub::yosys==0.27_29_g0f5e7c244=20230406_083352_py37 -> libstdcxx-ng[version='>=11.2.0']
#6 34.67 litex-hub::prjxray-tools==0.1_3015_gae546d6b=20220708_203356 -> libstdcxx-ng[version='>=11.2.0']
#6 34.67 Package curl conflicts for:
#6 34.67 git -> curl
#6 34.67 Package pcre conflicts for:
#6 34.67 git -> pcre[version='>=8.43,<9.0a0']
#6 34.67 Package tbb conflicts for:
#6 34.67 litex-hub::vtr-optimized==8.0.0_5699_g25e723a24=20220708_203356 -> tbb[version='<2021.0.0a0,>=2020.3']
#6 34.67 Package libcurl conflicts for:
#6 34.67 git -> libcurl[version='>=7.57.0,<8.0a0|>=7.58.0,<8.0a0|>=7.59.0,<8.0a0|>=7.60.0,<8.0a0|>=7.61.0,<8.0a0|>=7.61.1,<8.0a0|>=7.63.0,<8.0a0|>=7.65.3,<8.0a0|>=7.80.0,<8.0a0']
#6 34.67 Package surelog conflicts for:
#6 34.67 litex-hub::symbiflow-yosys-plugins==1.0.0_7_1260_ge7070ca=20230225_164303 -> surelog
#6 34.67 Package gettext conflicts for:
#6 34.67 git -> gettext
#6 34.67 Package perl conflicts for:
#6 34.67 git -> perl=5
#6 34.67 Package libgcc-ng conflicts for:
#6 34.67 litex-hub::prjxray-tools==0.1_3015_gae546d6b=20220708_203356 -> libgcc-ng[version='>=11.2.0']
#6 34.67 litex-hub::symbiflow-yosys-plugins==1.0.0_7_1260_ge7070ca=20230225_164303 -> libgcc-ng[version='>=11.2.0']
#6 34.67 litex-hub::openfpgaloader==0.8.0_114_g057ce93=20220706_155948 -> libgcc-ng[version='>=11.2.0']
#6 34.67 make -> libgcc-ng[version='>=7.2.0']
#6 34.67 litex-hub::gcc-riscv64-elf-newlib==10.1.0=20220706_160221 -> libgcc-ng[version='>=11.2.0']
#6 34.67 simplejson -> libgcc-ng[version='>=11.2.0|>=7.2.0|>=7.3.0|>=7.5.0']
#6 34.67 git -> libgcc-ng[version='>=7.2.0|>=7.3.0|>=7.5.0']
#6 34.67 lxml -> libgcc-ng[version='>=11.2.0|>=7.2.0|>=7.3.0|>=7.5.0']
#6 34.67 litex-hub::vtr-optimized==8.0.0_5699_g25e723a24=20220708_203356 -> libgcc-ng[version='>=11.2.0']
#6 34.67 litex-hub::yosys==0.27_29_g0f5e7c244=20230406_083352_py37 -> libgcc-ng[version='>=11.2.0']
#6 34.67 Package tk conflicts for:
#6 34.67 litex-hub::symbiflow-yosys-plugins==1.0.0_7_1260_ge7070ca=20230225_164303 -> tk[version='>=8.6.12,<8.7.0a0']
#6 34.67 git -> tk[version='8.*|>=8.6.7,<8.7.0a0|>=8.6.8,<8.7.0a0']
#6 34.67 litex-hub::yosys==0.27_29_g0f5e7c244=20230406_083352_py37 -> tk[version='>=8.6.12,<8.7.0a0']
#6 34.67 Package gmp conflicts for:
#6 34.67 litex-hub::gcc-riscv64-elf-newlib==10.1.0=20220706_160221 -> gmp[version='>=6.2.1,<7.0a0']
#6 34.67 Package wheel conflicts for:
#6 34.67 pip -> wheel
#6 34.67 Package python conflicts for:
#6 34.67 intervaltree -> python
#6 34.67 lxml -> python[version='>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0']
#6 34.67 pip -> python[version='>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0']
#6 34.67 simplejson -> python[version='>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0']
#6 34.67 litex-hub::yosys==0.27_29_g0f5e7c244=20230406_083352_py37 -> python[version='>=3.7,<3.8.0a0']
#6 34.67 Package libusb conflicts for:
#6 34.67 litex-hub::openfpgaloader==0.8.0_114_g057ce93=20220706_155948 -> libusb
#6 34.67 Package libffi conflicts for:
#6 34.67 litex-hub::yosys==0.27_29_g0f5e7c244=20230406_083352_py37 -> libffi[version='>=3.4,<4.0a0']
#6 34.67 litex-hub::symbiflow-yosys-plugins==1.0.0_7_1260_ge7070ca=20230225_164303 -> libffi[version='>=3.4,<4.0a0']
#6 34.67 Package readline conflicts for:
#6 34.67 litex-hub::symbiflow-yosys-plugins==1.0.0_7_1260_ge7070ca=20230225_164303 -> readline[version='>=8.2,<9.0a0']
#6 34.67 Package pcre2 conflicts for:
#6 34.67 git -> pcre2[version='>=10.35,<10.36.0a0|>=10.37,<10.38.0a0']
#6 34.67 Package libhidapi conflicts for:
#6 34.67 litex-hub::openfpgaloader==0.8.0_114_g057ce93=20220706_155948 -> libhidapi
#6 34.67 Package zlib conflicts for:
#6 34.67 litex-hub::yosys==0.27_29_g0f5e7c244=20230406_083352_py37 -> zlib[version='>=1.2.13,<1.3.0a0']
#6 34.67 git -> zlib[version='>=1.2.11,<1.3.0a0']
#6 34.67 Package openssl conflicts for:
#6 34.67 git -> openssl[version='1.0.*|>=1.0.2m,<1.0.3a|>=1.0.2n,<1.0.3a|>=1.0.2o,<1.0.3a|>=1.0.2p,<1.0.3a|>=1.1.1a,<1.1.2a|>=1.1.1d,<1.1.2a|>=1.1.1k,<1.1.2a|>=1.1.1m,<1.1.2a']
#6 34.67 Package libiconv conflicts for:
#6 34.67 git -> libiconv
#6 34.67 Package gcc-riscv64-elf-nostdc conflicts for:
#6 34.67 litex-hub::gcc-riscv64-elf-newlib==10.1.0=20220706_160221 -> gcc-riscv64-elf-nostdc=10.1.0
#6 34.67 Package setuptools conflicts for:
#6 34.67 pip -> setuptools
#6 34.67 Package isl conflicts for:
#6 34.67 litex-hub::gcc-riscv64-elf-newlib==10.1.0=20220706_160221 -> isl[version='>=0.21,<0.22.0a0']
#6 34.67 Package yosys conflicts for:
#6 34.67 litex-hub::symbiflow-yosys-plugins==1.0.0_7_1260_ge7070ca=20230225_164303 -> yosys
#6 34.67 Package mpfr conflicts for:
#6 34.67 litex-hub::gcc-riscv64-elf-newlib==10.1.0=20220706_160221 -> mpfr[version='>=4.0.2,<5.0a0']
#6 34.67
------
executor failed running [/bin/sh -c cd symbiflow-examples &&     conda env create -f ./${FPGA_FAM}/environment.yml]: exit code: 1

C:\Users\User\Docker>

I need a help about this, does anyone who knows why it happend?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment