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