Skip to content

Commit

Permalink
Merge pull request #61 from datacite/no-travis
Browse files Browse the repository at this point in the history
Fix Dockerfile and add pull-request action
  • Loading branch information
jrhoads committed Jan 25, 2022
2 parents 19bb2f4 + 146c6e6 commit f5a1525
Show file tree
Hide file tree
Showing 6 changed files with 418 additions and 271 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pull_reqest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI Test
on:
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the stack
run: docker compose -f "docker-compose.yml" up -d
- name: Run Tests
run: docker compose -f "docker-compose.yml" run web ./bin/ci.sh
- name: Stop containers
if: always()
run: docker compose -f "docker-compose.yml" down
60 changes: 30 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
FROM phusion/passenger-customizable:2.0.0
LABEL maintiainer="[email protected]"

FROM phusion/passenger-full:1.0.6
# Set correct environment variables.
ENV HOME /home/app
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]

# Update installed APT packages
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get install -y ntp pandoc

# Fetch PIP install script and run
ADD "https://bootstrap.pypa.io/get-pip.py" /tmp/get-pip.py
RUN python3 /tmp/get-pip.py

# Fetch pipenv install script and run
ADD "https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py" /tmp/get-pipenv.py
RUN python3 /tmp/get-pipenv.py
# Allow app user to read /etc/container_environment
RUN usermod -a -G docker_env app

# Cleanup
RUN /pd_build/python.sh
# Update installed APT packages
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold"
RUN apt-get install -y ntp pandoc pipenv
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# Enable Passenger and Nginx and remove the default site
# Preserve env variables for nginx
RUN rm -f /etc/service/nginx/down && \
Expand All @@ -31,36 +31,36 @@ COPY vendor/docker/env.conf /etc/nginx/main.d/env.conf
# Use Amazon NTP servers
COPY vendor/docker/ntp.conf /etc/ntp.conf

# Run additional scripts during container startup (i.e. not at build time)
RUN mkdir -p /etc/my_init.d

# enable SSH
RUN rm -f /etc/service/sshd/down && \
/etc/my_init.d/00_regen_ssh_host_keys.sh

# install custom ssh key during startup
COPY vendor/docker/10_ssh.sh /etc/my_init.d/10_ssh.sh

# restart server on file changes in development
COPY vendor/docker/20_always_restart.sh /etc/my_init.d/20_always_restart.sh

## Viringo setup

# Copy webapp folder
COPY . /home/app/webapp/

# Copy tests over to app folder
COPY tests /home/app/tests

# Configure permissions
RUN chown -R app:app /home/app/webapp && \
chmod -R 755 /home/app/webapp

# Set working directory
WORKDIR /home/app/webapp

# Update Pip and Pipenv
RUN pip install -U pip pipenv

# Install any needed packages specified in pipenv pipfile
RUN pipenv install --system --deploy --ignore-pipfile

# Run additional scripts during container startup (i.e. not at build time)
RUN mkdir -p /etc/my_init.d

# enable SSH
RUN rm -f /etc/service/sshd/down && \
/etc/my_init.d/00_regen_ssh_host_keys.sh

# install custom ssh key during startup
COPY vendor/docker/10_ssh.sh /etc/my_init.d/10_ssh.sh

# restart server on file changes in development
COPY vendor/docker/20_always_restart.sh /etc/my_init.d/20_always_restart.sh

# Expose web
EXPOSE 80
EXPOSE 80
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ sentry-sdk = {extras = ["flask"],version = "*"}
python-dotenv = "*"

[requires]
python_version = "3.6"
python_version = "3.8"
Loading

0 comments on commit f5a1525

Please sign in to comment.