Skip to content
This repository was archived by the owner on Apr 10, 2021. It is now read-only.

Commit a5f5ef5

Browse files
committed
standalone try
1 parent d486104 commit a5f5ef5

File tree

5 files changed

+35
-8
lines changed

5 files changed

+35
-8
lines changed

docker/Dockerfile-standalone

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
1-
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
1+
FROM microsoft/dotnet:2.1-aspnetcore-runtime-alpine AS base
2+
RUN apk add --no-cache bash
23
WORKDIR /app
34
EXPOSE 80
45
EXPOSE 443
56

67
FROM microsoft/dotnet:2.1-sdk AS build
78
WORKDIR /src
9+
#backend
810
COPY ./docker/config/api/buildscript.sh ./build.sh
911
COPY . .
12+
#frontend
13+
COPY ./raw-cms-app/src /dist/wwwroot/
14+
COPY ./docker/config/standalone/env.json /dist/wwwroot/env/env.json
15+
COPY ./docker/config/standalone/bootstrap.sh /dist/bootstrap.sh
16+
17+
18+
RUN tr -d '\r' < ./build.sh > ./build.sh &&\
19+
tr -d '\r' < /dist/bootstrap.sh > /dist/bootstrap.sh &&\
20+
chmod +x ./build.sh &&\
21+
chmod +x /dist/bootstrap.sh &&\
22+
./build.sh
23+
1024

11-
RUN chmod +x ./build.sh && ./build.sh
1225

1326

14-
#frontend
15-
COPY ./raw-cms-app/src /app/wwwroot/ui
16-
COPY ./docker/config/api/env.json /app/wwwroot/ui/env/env.json
17-
COPY ./docker/config/ui/bootstrap.sh /tmp/bootstrap.sh
1827

1928

2029
FROM base AS final
2130
WORKDIR /app
2231
COPY --from=build /dist .
2332
ENV BASE_URL=/
2433

25-
CMD ["/bin/bash", "-c", "ls / && ls /tmp/ && /tmp/bootstrap.sh && dotnet /app/RawCMS.dll"]
34+
RUN ls /app -l
35+
36+
CMD ["/bin/bash", "-c", " /app/bootstrap.sh && dotnet /app/RawCMS.dll"]

docker/Dockerfile-ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN apk add --no-cache bash
1717
EXPOSE 80
1818
EXPOSE 4200 80
1919

20-
CMD ["/bin/bash", "-c", " /bootstrap.sh && nginx -g \"daemon off;\""]
20+
CMD ["/bin/bash", "-c", " sudo /bootstrap.sh && sudo nginx -g \"daemon off;\""]
2121

2222

2323

docker/config/standalone/bootstrap.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
echo "changin env.json"
3+
ls /app/wwwroot/ -lh
4+
ls /app/wwwroot/env/ -lh
5+
6+
#TODO replace with jq. this commands depends on positions
7+
sed -i "/baseUrl/c\ \"baseUrl\" : \"$BASE_URL\"" /app/wwwroot/env/env.json
8+
sed -i "/client_id/c\ \"client_id\" : \"$CLIENT_ID\"," /app/wwwroot/env/env.json
9+
sed -i "/client_secret/c\ \"client_secret\" : \"$CLIENT_SECRET\"" /app/wwwroot/env/env.json
10+
11+
12+
#main js
13+
#sed -i "/url/c\ \"url\" : \"/ui/env/enc.json\"," /app/wwwroot/main.js
14+
15+
cat /app/wwwroot/env/env.json
File renamed without changes.

docker/docker-compose-app.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ services:
1313
- ASPNETCORE_ENVIRONMENT=Docker
1414
- CLIENT_ID=raw.client
1515
- CLIENT_SECRET=raw.secret
16+
- BASE_URL=/
1617
# rawcms-api:
1718
# build:
1819
# dockerfile: ./docker/Dockerfile-api

0 commit comments

Comments
 (0)