Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds docker scripts for deployment #376

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data
11 changes: 11 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# Docker deployment

Read [README.md](/README.md) first.
Don't forget to adapt the app ID and signature as those can only be changed by rebuilding the container.
Also you need to clone submodules as the dockerfile requires them: `git submodule update --init`

Adapt:
- [AttestationProtocol.java:154-162](/src/main/java/app/attestation/server/AttestationProtocol.java#L154-L162) to your app ID and signature
- [AttestationServer.java:85-86](/src/main/java/app/attestation/server/AttestationServer.java#L85-L86) to your domain and protocol
- [AttestationServer.java:320](/src/main/java/app/attestation/server/AttestationServer.java#L320) to "0.0.0.0", or enable IPv6 support in docker
19 changes: 19 additions & 0 deletions docker/attestation-server.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM archlinux:base-20240101.0.204074

WORKDIR /app
RUN pacman --noconfirm -Sy jdk-openjdk

COPY . /app
RUN ./gradlew build

FROM fedora:39

RUN dnf -y update
RUN dnf -y install java-latest-openjdk-headless

WORKDIR /data
RUN mkdir /app
COPY --from=0 /app/build/libs/ /app
COPY --from=0 /app/libs/sqlite4java-prebuilt/ /usr/lib

CMD [ "/usr/bin/java", "-cp", "/app/*", "app.attestation.server.AttestationServer" ]
17 changes: 17 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3'

services:
attestation-server:
build:
context: ..
dockerfile: docker/attestation-server.dockerfile
container_name: attestation-server
volumes:
- ./data:/data
attestation-proxy:
build:
context: ..
dockerfile: docker/nginx-server.dockerfile
container_name: nginx
ports:
- 5000:80
37 changes: 37 additions & 0 deletions docker/nginx-server.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copying same dockerfile content, as they are built only once
FROM archlinux:base-20240101.0.204074

# Installing dev dependencies
# moreutils is required for packages: sponge
RUN pacman --noconfirm -Sy jdk-openjdk zopfli parallel yajl brotli nginx-mod-brotli python3 python-pip nodejs npm libxml2 moreutils

ENV GITHUB_ACTIONS="true"
ENV PATH="/opt/venv/bin:$PATH"
ENV SKIP_REMOTE_PUBLISHING="1"


WORKDIR /app
COPY . /app

RUN npm i
RUN python -m venv /opt/venv
RUN pip install -r requirements.txt

RUN ./process-static

FROM archlinux:base-20240101.0.204074

RUN pacman --noconfirm -Sy nginx nginx-mod-brotli

COPY --from=0 /app/nginx-tmp/nginx.conf /etc/nginx/
COPY --from=0 /app/nginx-tmp/mime.types /etc/nginx/
COPY --from=0 /app/nginx-tmp/root_attestation.app.conf /etc/nginx/
COPY --from=0 /app/nginx-tmp/snippets /etc/nginx/snippets
COPY --from=0 /app/static-tmp /srv/attestation.app_a
COPY ./docker/nginx/nginx.conf /etc/nginx/nginx.conf

RUN mkdir -p /etc/nginx/modules/
RUN ln -s /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so /etc/nginx/modules/ngx_http_brotli_filter_module.so
RUN ln -s /usr/lib/nginx/modules/ngx_http_brotli_static_module.so /etc/nginx/modules/ngx_http_brotli_static_module.so

CMD [ "nginx", "-g", "daemon off;" ]
Loading