Skip to content

Commit

Permalink
Merge pull request lfortran#4632 from Shaikh-Ubaid/ubaid/pr/add_docke…
Browse files Browse the repository at this point in the history
…r_build

Add `dockerfile` to support building docker image
  • Loading branch information
Shaikh-Ubaid authored Aug 19, 2024
2 parents 5b0181e + 5610ffe commit c032d16
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/upload_docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Create and publish a Docker image

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io
USER: lfortran
PROJECT: lfortran

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Log in to the Container registry
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USER }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: ${{ env.REGISTRY }}/${{ env.USER }}/${{ env.PROJECT }}:latest
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:22.04 AS build

USER root

RUN apt update
RUN apt install curl git build-essential binutils-dev zlib1g-dev clang -y

RUN curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
RUN bash Miniforge3-$(uname)-$(uname -m).sh -b

RUN /root/miniforge3/bin/mamba init bash

WORKDIR /lfortran

COPY . .

RUN /root/miniforge3/bin/mamba env create -f environment_linux.yml -y
SHELL ["/root/miniforge3/bin/mamba", "run", "-n", "lf", "/bin/bash", "-c"]

RUN ./build1.sh

RUN ctest
RUN python integration_tests/run_tests.py
RUN python run_tests.py

FROM ubuntu:22.04 AS app

RUN apt update
RUN apt install binutils clang --no-install-recommends -y

COPY --from=build /lfortran/inst /app

0 comments on commit c032d16

Please sign in to comment.