Implement Jekyll CI workflow with docker #2
|
@ -5,8 +5,6 @@ on: [push]
|
||||||
env:
|
env:
|
||||||
_UID: 1000
|
_UID: 1000
|
||||||
_GID: 1000
|
_GID: 1000
|
||||||
_USER: appuser
|
|
||||||
_GROUP: appgroup
|
|
||||||
jobs:
|
jobs:
|
||||||
jekyll:
|
jekyll:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
@ -40,13 +38,13 @@ jobs:
|
||||||
- name: Verify Jekyll container
|
- name: Verify Jekyll container
|
||||||
id: verify_image
|
id: verify_image
|
||||||
run: |
|
run: |
|
||||||
docker-compose run --rm -v "${JOB_CONTAINER_NAME}/:/home/${USER}/workspace" \
|
docker-compose run --rm -v "${JOB_CONTAINER_NAME}/:/appdata" \
|
||||||
--entrypoint bash \
|
--entrypoint bash \
|
||||||
jekyll -c "whoami; pwd; ls -lA ."
|
jekyll -c "whoami; pwd; ls -lA ."
|
||||||
- name: Build Jekyll site
|
- name: Build Jekyll site
|
||||||
id: build_site
|
id: build_site
|
||||||
run: |
|
run: |
|
||||||
docker-compose run --rm -v "${JOB_CONTAINER_NAME}:/home/${_USER}/workspace" \
|
docker-compose run --rm -v "${JOB_CONTAINER_NAME}:/appdata" \
|
||||||
jekyll build --verbose
|
jekyll build --verbose
|
||||||
- name: Verify site
|
- name: Verify site
|
||||||
id: verify_site
|
id: verify_site
|
||||||
|
|
|
@ -9,8 +9,8 @@ services:
|
||||||
gid: "${_GID:-1000}"
|
gid: "${_GID:-1000}"
|
||||||
group: "${_GROUP:-appgroup}"
|
group: "${_GROUP:-appgroup}"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/home/ubuntu/workspace
|
- .:/appdata
|
||||||
working_dir: /home/ubuntu/workspace
|
working_dir: /appdata
|
||||||
ports:
|
ports:
|
||||||
- "4000:4000"
|
- "4000:4000"
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
|
|
@ -26,15 +26,15 @@ RUN chown "${user}:${group}" "/home/${user}/Gemfile"*
|
||||||
|
|
||||||
# Switch to non-root user
|
# Switch to non-root user
|
||||||
USER ${user}
|
USER ${user}
|
||||||
WORKDIR /home/${user}
|
WORKDIR /appdata
|
||||||
|
|
||||||
# Install required gems
|
# Install required gems
|
||||||
RUN echo "gem: --no-document --user-install --bindir /home/${user}/bin" >> /home/${user}/.gemrc && \
|
RUN echo "gem: --no-document --user-install --bindir /home/${user}/bin" >> /home/${user}/.gemrc && \
|
||||||
echo "gempath: /home/${user}/.gem/ruby:/home/${user}/.bundle/gems/ruby/3.3.0" >> .gemrc && \
|
echo "gempath: /home/${user}/.gem/ruby:/home/${user}/.bundle/gems/ruby/3.3.0" >> /home/${user}/.gemrc && \
|
||||||
gem install bundler --version `sed -n -r -e '/BUNDLED WITH/,$ { s/\s+([.0-9]+)/\1/ p }' Gemfile.lock` && \
|
gem install bundler --version `sed -n -r -e '/BUNDLED WITH/,$ { s/\s+([.0-9]+)/\1/ p }' /home/${user}/Gemfile.lock` && \
|
||||||
bundle config --global path /home/${user}/.bundle/gems && \
|
bundle config --global path /home/${user}/.bundle/gems && \
|
||||||
bundle config --global bin /home/${user}/bin && \
|
bundle config --global bin /home/${user}/bin && \
|
||||||
bundle install && \
|
bundle install --gemfile=/home/${user}/Gemfile && \
|
||||||
rm -rf /home/${user}/.bundle/cache
|
rm -rf /home/${user}/.bundle/cache
|
||||||
|
|
||||||
ENV PATH=/home/${user}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
ENV PATH=/home/${user}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
Loading…
Reference in New Issue