[X] The documentation does not mention anything about my problem
[X] There are no open or closed issues that are related to my problem
Description
Hi,
I am new to Docker and would appreciate any feedbacks. I am building a practice website and having an issue where the docker file produced is different than what I do in my terminal.
In my terminal, I am using this command:
docker build -t kintsang/devsecopsforums:1.2 .
This is in the docker file:
FROM node:20.10.0
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]
Due to the reason that I am having to enter in the environment variables to mirror the .env.local file that the app gets when I do a docker build locally from my terminal, I change the Dockerfile to the below whenever I use the pipeline.yml file:
FROM node:20.10.0
ARG CLERK_SECRET_KEY=""
ARG MONGODB_URL=""
ARG NEXT_CLERK_WEBHOOK_SECRET=""
ARG NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=""
ARG NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=""
ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=""
ARG NEXT_PUBLIC_CLERK_SIGN_IN_URL=""
ARG NEXT_PUBLIC_CLERK_SIGN_UP_URL=""
ARG NEXT_PUBLIC_SERVER_URL=""
ARG NEXT_PUBLIC_TINY_EDITOR_API_KEY=""
ARG OPENAI_API_KEY=""
WORKDIR /app
COPY . .
RUN npm install
RUN printf "$CLERK_SECRET_KEY" >> .env
RUN printf "$MONGODB_URL" >> .env
RUN printf "$NEXT_CLERK_WEBHOOK_SECRET" >> .env
RUN printf "$NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL" >> .env
RUN printf "$NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL" >> .env
RUN printf "$NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY" >> .env
RUN printf "$NEXT_PUBLIC_CLERK_SIGN_IN_URL" >> .env
RUN printf "$NEXT_PUBLIC_CLERK_SIGN_UP_URL" >> .env
RUN printf "$NEXT_PUBLIC_SERVER_URL" >> .env
RUN printf "$NEXT_PUBLIC_TINY_EDITOR_API_KEY" >> .env
RUN printf "$OPENAI_API_KEY" >> .env
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]
Both dockerfiles should be the same and have the same enironment variables but for some reason when I do a docker run in the terminal docker file kintsang/devsecopsforum:1.2, it can spin up a website, whereas for kintsang/devsecops-forum:latest, it returns a 500 Internal Server Error
I would expect both docker files to be the same. Since all that are being added to the Dockerfile when using the pipeline.yml are arguments to subtitle the variables in my .env.local local file that I do not want to commit.
I am not sure where the discrepancy between the two docker files (one built in my own terminal locally, one built on GitHub Workflows) since the dockerfile is pretty simple.
Thank you for the help!
Expected behaviour
I am expecting both the docker files (one built in my own terminal, one built on GitHub Workflows) to be identical.
Actual behaviour
The Docker file built from my terminal is working whereas the Docker file built from the GitHub Workflow is broken.
Contributing guidelines
I've found a bug, and:
Description
Hi,
I am new to Docker and would appreciate any feedbacks. I am building a practice website and having an issue where the docker file produced is different than what I do in my terminal.
In my terminal, I am using this command:
docker build -t kintsang/devsecopsforums:1.2 .
This is in the docker file:
This is the .dockerignore:
I am trying to make a CI/CD pipeline where I will build the dockerfile and then have it ssh-ed into my ec2 using GIthub Actions.
This is the pipeline.yml file:
Due to the reason that I am having to enter in the environment variables to mirror the
.env.local
file that the app gets when I do a docker build locally from my terminal, I change the Dockerfile to the below whenever I use the pipeline.yml file:Both dockerfiles should be the same and have the same enironment variables but for some reason when I do a docker run in the terminal docker file
kintsang/devsecopsforum:1.2
, it can spin up a website, whereas forkintsang/devsecops-forum:latest
, it returns a 500 Internal Server ErrorI would expect both docker files to be the same. Since all that are being added to the Dockerfile when using the pipeline.yml are arguments to subtitle the variables in my
.env.local
local file that I do not want to commit.I am not sure where the discrepancy between the two docker files (one built in my own terminal locally, one built on GitHub Workflows) since the dockerfile is pretty simple.
Thank you for the help!
Expected behaviour
I am expecting both the docker files (one built in my own terminal, one built on GitHub Workflows) to be identical.
Actual behaviour
The Docker file built from my terminal is working whereas the Docker file built from the GitHub Workflow is broken.
Repository URL
No response
Workflow run URL
No response
YAML workflow
Workflow logs
No response
BuildKit logs
No response
Additional info
No response