Skip to content

Commit

Permalink
provide possibility to locally build website with all required steps
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmehl committed May 5, 2022
1 parent 2beb5ac commit ad7c400
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
47 changes: 45 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,54 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

FROM bitnami/apache:2.4
# =============================================================================
# Configure webserver
# =============================================================================

COPY site/public/ /app/
FROM bitnami/apache:2.4 as webserver-prep

COPY reuse.software.conf /vhosts/

## Enable mod_expires module
RUN sed -i -r 's/#LoadModule expires_module/LoadModule expires_module/' /opt/bitnami/apache/conf/httpd.conf


# =============================================================================
# Production (use the site built in hugo step in .drone.yml)
# =============================================================================

FROM webserver-prep as production

COPY site/public/ /app/


# =============================================================================
# Development Preparation: run sync-docs, po4a and hugo
# =============================================================================

FROM alpine:3 as dev-prep

# Dependencies
RUN apk --no-cache add bash perl-yaml-tiny po4a hugo

COPY . /app

WORKDIR /app/

# sync and translate docs (from their own po files)
RUN bash sync-docs.sh

# Run po4a for reuse-website po strings
RUN cd site/ && po4a po/po4a.conf

# Build hugo
RUN hugo -s site


# =============================================================================
# Production (use the site built in dev-prep)
# =============================================================================

FROM webserver-prep as development

COPY --from=dev-prep /app/site/public/ /app/
29 changes: 29 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: Free Software Foundation Europe e.V.
#
# SPDX-License-Identifier: GPL-3.0-or-later

# =============================================================================
# sync docs, translate, and build hugo in Docker container
# =============================================================================

version: "3"
services:
reuse-web:
container_name: reuse-web
build:
context: .
target: development
image: reuse-web
restart: always
logging:
driver: json-file
options:
max-size: "5m"
max-file: "5"
# Reverse Proxy
labels:
proxy.host: "reuse.software"
proxy.host_alias: "www.reuse.software"
proxy.port: "6140"
ports:
- "6140:8080"
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ version: "3"
services:
reuse-web:
container_name: reuse-web
build: .
build:
context: .
target: production
image: reuse-web
restart: always
logging:
Expand Down

0 comments on commit ad7c400

Please sign in to comment.