Dubinek
Dubinek
DDeno
Created by Dubinek on 11/8/2024 in #help
Enviromental variable on GCE
Hi, I am having weird issue where from some reason, passing env vars on Compute Engine VM doesn't pass the variables into the container where Deno is running. While same command on my local works like a charm. And I am starting to pull my hair, I've renamed to camelCase then to SCREAMING_CASE without luck. Main.ts
const allowedOrigin = Deno.env.get("ALLOWED_ORIGIN") || "https://127.0.0.1:8081";
const allowedOrigin = Deno.env.get("ALLOWED_ORIGIN") || "https://127.0.0.1:8081";
Dockerfile
FROM denoland/deno:2.0.5
EXPOSE 42069
WORKDIR /app
COPY . .
RUN chown -R deno:deno /app
COPY certs ./certs
USER deno
RUN deno cache main.ts
CMD ["run", "--allow-net", "--allow-env", "--allow-read", "main.ts"]
FROM denoland/deno:2.0.5
EXPOSE 42069
WORKDIR /app
COPY . .
RUN chown -R deno:deno /app
COPY certs ./certs
USER deno
RUN deno cache main.ts
CMD ["run", "--allow-net", "--allow-env", "--allow-read", "main.ts"]
And command that works fine on local, but fails on CoOS on GCE.
docker run -e ALLOWED_ORIGIN=https://example.com -e SOME_VAR=val1 -e SOME_OTH=val2 -p 42069:42069 imageName
docker run -e ALLOWED_ORIGIN=https://example.com -e SOME_VAR=val1 -e SOME_OTH=val2 -p 42069:42069 imageName
I am lost, please help good people here. Thanks
1 replies