Skip to content

Commit f365ef0

Browse files
Add Docker image
1 parent 64dac49 commit f365ef0

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed

.dockerignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw*

Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM node:10-alpine as build
2+
3+
# args
4+
ARG version="0.1.0"
5+
ARG repo="github.com/productionwentdown/dri"
6+
7+
# dependencies
8+
RUN apk add --no-cache git
9+
10+
# source
11+
WORKDIR /app
12+
COPY . .
13+
14+
# build
15+
RUN yarn install
16+
RUN yarn build
17+
18+
19+
FROM alpine:3.8
20+
21+
ARG version
22+
23+
# labels
24+
LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/email-collector"
25+
LABEL org.label-schema.version=${version}
26+
LABEL org.label-schema.schema-version="1.0"
27+
28+
# copy build output
29+
COPY --from=build /app/dist /srv
30+
# copy caddy
31+
COPY --from=productionwentdown/caddy:0.11.0 /bin/caddy /usr/local/bin/caddy
32+
# copy entrypoint.sh
33+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
34+
35+
ENTRYPOINT ["entrypoint.sh"]
36+
CMD ["caddy", "-conf", "/etc/Caddyfile"]

entrypoint.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
BASE_URL=${BASE_URL:=/}
4+
5+
REGISTRY_HOST=${REGISTRY_HOST:=""}
6+
REGISTRY_API=${REGISTRY_API:=""}
7+
8+
REPOSITORIES_PER_PAGE=${REPOSITORIES_PER_PAGE:=0}
9+
TAGS_PER_PAGE=${TAGS_PER_PAGE:=30}
10+
11+
[[ "$USE_PORTUS_EXPLORE" != "true" ]] && [[ "$USE_PORTUS_EXPLORE" != "false" ]] && USE_PORTUS_EXPLORE=false
12+
13+
sed -i "s~<base href=/>~<base href=\"$BASE_URL\">~" /srv/index.html
14+
15+
cat > /etc/Caddyfile << EOF
16+
:80$BASE_URL {
17+
root /srv
18+
browse
19+
rewrite {
20+
regexp (.*)
21+
to {1} {1}/ /
22+
}
23+
}
24+
EOF
25+
26+
cat > /srv/config.json << EOF
27+
{
28+
"registryHost": "$REGISTRY_HOST",
29+
"registryAPI": "$REGISTRY_API",
30+
"repositoriesPerPage": $REPOSITORIES_PER_PAGE,
31+
"tagsPerPage": $TAGS_PER_PAGE,
32+
"usePortusExplore": $USE_PORTUS_EXPLORE
33+
}
34+
EOF
35+
36+
"$@"

0 commit comments

Comments
 (0)