Skip to content
Merged
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CLIENT=rees46
25 changes: 25 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish

on:
pull_request:
types:
- closed
branches:
- master
paths-ignore:
- .github
workflow_dispatch:

jobs:
docker:
if: |
github.event_name == 'workflow_dispatch' ||
(
github.event.pull_request.merged == true &&
!startsWith(github.head_ref, 'release/')
)
name: Build Docker image and push
uses: rees46/workflow/.github/workflows/docker-publish.yaml@master
permissions: write-all
with:
packageName: api-docs
48 changes: 34 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
FROM ruby:2.7-slim
FROM ruby:2.7.5-slim AS base

WORKDIR /srv/slate
ARG BUNDLE_WITHOUT="test:development"
ENV BUNDLE_WITHOUT="${BUNDLE_WITHOUT}"

VOLUME /srv/slate/source
EXPOSE 4567
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
nodejs && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

COPY . /srv/slate
WORKDIR /app

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
nodejs \
&& gem install bundler -v 2.4.22\
&& bundle install \
&& apt-get remove -y build-essential \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
COPY Gemfile Gemfile.lock ./

RUN BUNDLER_VERSION=$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -1 | tr -d ' ') && \
gem install bundler -v "$BUNDLER_VERSION"

RUN bundle install

COPY . .

CMD ["bundle", "exec", "middleman", "server", "--watcher-force-polling"]

FROM base AS build

ARG BUNDLE_WITHOUT="test:development"
ENV BUNDLE_WITHOUT="${BUNDLE_WITHOUT}"

RUN ./configure.sh r46 && bundle exec middleman build && mv build /opt/rees46
RUN ./configure.sh kameleoon && bundle exec middleman build && mv build /opt/kameleoon
RUN ./configure.sh pc && bundle exec middleman build && mv build /opt/personaclick

FROM nginx:1 AS prod

ENV CLIENT=rees46

COPY --from=build /opt /usr/share/nginx/html
COPY ./config/nginx.conf /etc/nginx/templates/default.conf.template
8 changes: 8 additions & 0 deletions config/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 80;

location / {
root /usr/share/nginx/html/${CLIENT};
try_files $uri $uri/ =404;
}
}
32 changes: 32 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
x-environment: &environment
env_file:
- path: ./.env.example
required: true
- path: ./.env
required: false

networks:
rees46:
name: rees46
driver: bridge

services:
api-docs:
<<: *environment
image: ghcr.io/rees46/api-docs:latest
build:
context: .
target: base
args:
BUNDLE_WITHOUT: ''
ports:
- '${PORT_PUBLIC:-8080}:80'
networks:
- rees46
develop:
watch:
- action: sync
path: .
target: /app
- action: rebuild
path: ./Gemfile.lock