forked from COINtoolbox/RESSPECT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing up Dockerfile, adding github action to build image
- Image installs resspect from source - Image builds on latest ubuntu avoiding conflicts with ubuntu's version of pip - Image sets up a data directory and a venv for resspect - Image does not yet work with the docker-compose file or the TOM docker-compose ecosystem.
- Loading branch information
Showing
3 changed files
with
63 additions
and
13 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,33 @@ | ||
|
||
name: Build Docker image | ||
# Shamelessly cribbed from https://docs.docker.com/build/ci/github-actions/test-before-push/ | ||
# with minor modifications | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
TEST_TAG: user/app:test | ||
LATEST_TAG: user/app:latest | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and export to Docker | ||
uses: docker/build-push-action@v6 | ||
with: | ||
load: true | ||
tags: ${{ env.TEST_TAG }} | ||
|
||
- name: Test | ||
run: | | ||
docker run --rm ${{ env.TEST_TAG }} -c "fit_dataset --help" |
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 |
---|---|---|
@@ -1,27 +1,44 @@ | ||
FROM ubuntu | ||
|
||
WORKDIR /resspect | ||
ENV HOME / | ||
ENV RESSPECT_DIR=/resspect | ||
ENV RESSPECT_SRC=${RESSPECT_DIR}/resspect-src | ||
ENV RESSPECT_VENV=${RESSPECT_DIR}/resspect-venv | ||
ENV RESSPECT_VENV_BIN=${RESSPECT_VENV}/bin | ||
ENV RESSPECT_WORK=${RESSPECT_DIR}/resspect-work | ||
|
||
WORKDIR ${RESSPECT_DIR} | ||
|
||
#ENV HOME=/ | ||
|
||
RUN echo "entering resspect Dockerfile" | ||
|
||
RUN apt-get update && \ | ||
RUN apt-get update && \ | ||
apt-get -y upgrade && \ | ||
apt-get clean && \ | ||
apt-get install -y python3 python3-pip postgresql-client && \ | ||
apt-get install -y python3 python3-pip python3-venv postgresql-client git && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN ln -s /usr/bin/python3 /usr/bin/python | ||
|
||
RUN pip install --upgrade pip | ||
# Copy over resspect | ||
ADD . ${RESSPECT_SRC} | ||
|
||
# Create a venv for resspect | ||
RUN python3 -m venv ${RESSPECT_VENV} | ||
|
||
COPY pyproject.toml ./pyproject.toml | ||
RUN pip install dephell[full] && \ | ||
dephell deps convert --from=pyproject.toml --to=requirements.txt && \ | ||
pip install -r requirements.txt && \ | ||
pip uninstall -y dephell && \ | ||
rm -rf /root/.cache/pip | ||
# Use this venv for future python commands in this dockerfile | ||
ENV PATH=${RESSPECT_VENV_BIN}:$PATH | ||
|
||
# Activate the venv every time we log in. | ||
RUN touch /root/.bashrc && echo "source ${RESSPECT_VENV_BIN}/activate" >> /root/.bashrc | ||
|
||
# Install resspect and dependencies to the venv | ||
RUN pip install -e ${RESSPECT_SRC} | ||
|
||
# Create a sample work dir for resspect | ||
RUN mkdir -p ${RESSPECT_WORK}/results | ||
RUN mkdir -p ${RESSPECT_WORK}/plots | ||
RUN cp -r ${RESSPECT_SRC}/data ${RESSPECT_WORK} | ||
|
||
EXPOSE 8081 | ||
ENTRYPOINT ["bash"] | ||
|
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