Skip to content

[refactor] Read Env in running time #30

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

Merged
merged 13 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ dist-ssr
*.sln
*.sw?
.env
*.ps1
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@ ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

FROM base AS prod

WORKDIR /app
COPY . .

RUN pnpm install --frozen-lockfile
RUN pnpm run build

FROM nginx:stable-alpine
RUN apk add --no-cache nginx

COPY nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=prod /app/dist/ /app

EXPOSE 80

CMD [ "nginx" ]
CMD [ "cd /app && pnpm run build && nginx -g 'daemon off;'" ]
8 changes: 8 additions & 0 deletions farm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ export default defineConfig({
alias: {
"~/": path.join(process.cwd(), "src"),
}
},
define: {
SD_BACKEND_URL: process.env.SD_BACKEND_URL,
SD_CLIENT_ID: process.env.SD_CLIENT_ID,
SD_AUTHORITY_URL: process.env.SD_AUTHORITY_URL,
SD_REDIRECT_URL: process.env.SD_REDIRECT_URL,
SD_LOGOUT_REDIRECT_URL: process.env.SD_LOGOUT_REDIRECT_URL,
SD_AUTH_SECRET: process.env.SD_AUTH_SECRET,
}
},
envPrefix: "SD_",
Expand Down
8 changes: 4 additions & 4 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
server {
listen 80 default_server;

root /app;
root /app/dist;

# Logging
access_log /dev/stdout;
error_log /dev/stderr;
# Logging
access_log /dev/stdout;
error_log /dev/stderr;

location / {
try_files $uri $uri/ /index.html;
Expand Down