Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve dependencies for offline execution #60

Open
wants to merge 7 commits into
base: ng-beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,26 @@ In order to automatically build and push new images via [Github Actions](https:/
* Create [secrets for your repository](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository)
* `DOCKERHUB_USERNAME`: Your Docker Hub username (or of your organization), e.g., `doctoolchain`.
* `DOCKERHUB_TOKEN`: **Caution**: Do not store your password here but [generate a suitable token](https://hub.docker.com/settings/security?generateToken=true) (Read/Write should be sufficient).

## Test if image can be used offline

Build image locally:

```
cd alpine-latest
docker build --progress=plain --build-arg DTC_VERSION=v3.3.1 -t dtc-local:v3.3.1 .
```

run it:

```
docker run -it dtc-local:v3.3.1
```

now enter the following and see if it works:

```
cd
./dtcw generateSite --info
```

38 changes: 22 additions & 16 deletions alpine-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,29 @@ USER dtcuser
WORKDIR /home/dtcuser
ENV HOME=/home/dtcuser

ENV GRADLE_USER_HOME=/home/dtcuser/.gradle
ENV GRADLE_USER_HOME=/home/dtcuser/.doctoolchain/.gradle

ARG DTC_VERSION
RUN curl -LO https://github.com/docToolchain/docToolchain/releases/download/${DTC_VERSION}/docToolchain-${DTC_VERSION#?}.zip \
&& unzip docToolchain-${DTC_VERSION#?}.zip \
&& mv docToolchain-${DTC_VERSION#?} docToolchain \
&& rm docToolchain-${DTC_VERSION#?}.zip \
&& cd docToolchain \
# This is a workaround to suppress the initialization phase of docToolchain. \
# We should consider a '--no-init' option in the future.
&& cp template_config/Config.groovy . \
&& umask g+w \
&& ./gradlew downloadDependencies \
&& chmod -R o=u $GRADLE_USER_HOME \
&& chmod -R g=u $GRADLE_USER_HOME \
&& rm -r $GRADLE_USER_HOME/daemon \
&& chmod -R o=u $HOME
RUN git clone --branch ng https://github.com/docToolchain/docToolchain.git && \
cd docToolchain && \
git fetch --tags && \
git submodule update -i && \
# remove .git folders
rm -rf `find -type d -name .git` && \
umask g+w && \
./gradlew downloadDependencies --info && \
chmod -R o=u $GRADLE_USER_HOME && \
chmod -R g=u $GRADLE_USER_HOME && \
rm -r $GRADLE_USER_HOME/daemon && \
chmod -R o=u $HOME

# trying to get the last dependencies

RUN curl -Lo dtcw https://doctoolchain.org/dtcw && \
chmod +x dtcw

RUN ./dtcw install doctoolchain
RUN echo y | ./dtcw local tasks

ENV PATH="/home/dtcuser/docToolchain/bin:${PATH}"

Expand All @@ -57,4 +63,4 @@ WORKDIR /project

VOLUME /project

ENTRYPOINT /bin/bash
ENTRYPOINT /bin/bash
36 changes: 21 additions & 15 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,30 @@ USER dtcuser
WORKDIR /home/dtcuser
ENV HOME=/home/dtcuser

ENV GRADLE_USER_HOME=/home/dtcuser/.gradle
ENV GRADLE_USER_HOME=/home/dtcuser/.doctoolchain/.gradle

ARG DTC_VERSION
RUN curl -LO https://github.com/docToolchain/docToolchain/releases/download/${DTC_VERSION}/docToolchain-${DTC_VERSION#?}.zip \
&& unzip docToolchain-${DTC_VERSION#?}.zip \
&& mv docToolchain-${DTC_VERSION#?} docToolchain \
&& rm docToolchain-${DTC_VERSION#?}.zip \
&& cd docToolchain \
# This is a workaround to suppress the initialization phase of docToolchain. \
# We should consider a '--no-init' option in the future.
&& cp template_config/Config.groovy . \
&& umask g+w \
&& ./gradlew downloadDependencies \
&& chmod -R o=u $GRADLE_USER_HOME \
&& chmod -R g=u $GRADLE_USER_HOME \
&& rm -r $GRADLE_USER_HOME/daemon \
&& chmod -R o=u $HOME
RUN curl -LO https://github.com/docToolchain/docToolchain/releases/download/${DTC_VERSION}/docToolchain-${DTC_VERSION#?}.zip \
&& unzip docToolchain-${DTC_VERSION#?}.zip \
&& mv docToolchain-${DTC_VERSION#?} docToolchain \
&& rm docToolchain-${DTC_VERSION#?}.zip \
&& cd docToolchain \
# This is a workaround to suppress the initialization phase of docToolchain. \
# We should consider a '--no-init' option in the future.
&& cp template_config/Config.groovy . && \
umask g+w && \
./gradlew downloadDependencies && \
chmod -R o=u $GRADLE_USER_HOME && \
chmod -R g=u $GRADLE_USER_HOME && \
rm -r $GRADLE_USER_HOME/daemon && \
chmod -R o=u $HOME

# trying to get the last dependencies
RUN export DTC_VERSION=${DTC_VERSION#?} && \
curl -Lo dtcw https://doctoolchain.org/dtcw && \
chmod +x dtcw && \
./dtcw install doctoolchain && \
echo y | ./dtcw local tasks
ENV PATH="/home/dtcuser/docToolchain/bin:${PATH}"

USER dtcuser
Expand Down