-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
98 lines (70 loc) · 2.54 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
FROM nginx:1.26.0-alpine AS base
EXPOSE 8080 8081
# Set to run as non-root user
RUN addgroup --system --gid 1000 customgroup \
&& adduser --system --uid 1000 --ingroup customgroup --shell /bin/sh customuser
RUN chown customuser:customgroup -R /usr/share/nginx/html
# Override NGINX's default.conf and nginx.conf
COPY ./nginx/nginx-template.conf /etc/nginx/conf.d/default.conf
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/stub-status.conf /etc/nginx/conf.d/stub-status.conf
COPY ./nginx/security-headers.conf /etc/nginx/security-headers.conf
RUN chown -R 1000: /etc/nginx/conf.d/default.conf
############
# Use Ruby as build. It will not be published, but will
# generate files to /output
FROM ruby:3.2 as build
ARG FSH_SUSHI_VERSION=3.10.0
# https://github.com/inadarei/alpine-jekyll/blob/master/Dockerfile
RUN gem install --no-document \
redcarpet \
kramdown \
maruku \
rdiscount \
RedCloth \
liquid \
pygments.rb \
safe_yaml \
jekyll \
jekyll-paginate \
jekyll-sass-converter \
jekyll-sitemap \
jekyll-feed \
jekyll-redirect-from
# add node
RUN apt-get update && apt-get install nodejs npm --no-install-recommends -y --fix-missing
# add java
RUN apt-get install -y openjdk-17-jdk
ENV JAVA_HOME /usr/lib/jvm/java-1.17-openjdk
ENV PATH $PATH:/usr/lib/jvm/java-1.17-openjdk/jre/bin:/usr/lib/jvm/java-1.17-openjdk/bin
# add misc
RUN apt-get install -y curl jq --no-install-recommends
# anticipate source mounted to /src
RUN mkdir -p /src
WORKDIR /src
# Handle Jekyll error because it can't create the following folder
RUN mkdir ./temp/pages/.jekyll-cache ./output -p
COPY . .
# Allow the following .sh files to be executed
RUN chmod u+x ./_downloadPublisher.sh ./_genonce.sh
# Download the fhir-ig-publisher
RUN ./_downloadPublisher.sh
# add the sushi tool
RUN npm install -g fsh-sushi@${FSH_SUSHI_VERSION}
# Copy all allowed content to the root directory
COPY . .
# Update the publisher to the newest version, so it is ready to run on command
RUN ./_genonce.sh
############# Make it skip installation process, because it's always the same
# FROM ig-base:local as worker
# WORKDIR /src
# # Copy all allowed content to the root directory
# COPY . .
# # Update the publisher to the newest version, so it is ready to run on command
# RUN ./_genonce.sh
FROM base AS final
# Get files to be served
COPY --from=build ./src/output /usr/share/nginx/html
# COPY --from=worker ./src/output /usr/share/nginx/html
# Change to user 1000
USER 1000