diff --git a/docker-compose.yml b/docker-compose.yml index faa43b0..9f25f52 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,8 +27,8 @@ services: build: context: ./frontend args: - VITE_API_URL: http://backend - VITE_API_PORT: 8080 + TUTO_API_URL: http://backend + TUTO_API_PORT: 8080 image: pdelebarre/guitar-tutorial-app-frontend ports: diff --git a/frontend/.env b/frontend/.env deleted file mode 100644 index ef62e7e..0000000 --- a/frontend/.env +++ /dev/null @@ -1,3 +0,0 @@ -VITE_API_URL=http://backend -VITE_API_PORT=8080 -# VITE_ENVIRONMENT=DEVELOPMENT \ No newline at end of file diff --git a/frontend/.env.development b/frontend/.env.development new file mode 100644 index 0000000..5feeb89 --- /dev/null +++ b/frontend/.env.development @@ -0,0 +1,3 @@ +VITE_API_URL=http://localhost +VITE_API_PORT=8080 +VITE_ENVIRONMENT=DEVELOPMENT \ No newline at end of file diff --git a/frontend/.env.production b/frontend/.env.production new file mode 100644 index 0000000..49677ff --- /dev/null +++ b/frontend/.env.production @@ -0,0 +1,3 @@ +VITE_API_URL=TUTO_API_URL +VITE_API_PORT=TUTO_API_PORT +VITE_ENVIRONMENT=PRODUCTION \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 34fb828..6b306ba 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -4,13 +4,7 @@ FROM node:18-alpine AS builder # Set the working directory inside the container WORKDIR /app -# Define build args -ARG VITE_API_URL -ENV VITE_API_URL=${VITE_API_URL} -ARG VITE_API_PORT -ENV VITE_API_PORT=${VITE_API_PORT} - -COPY .env . +# COPY .env . # Copy package.json and package-lock.json COPY package*.json ./ @@ -31,8 +25,8 @@ COPY --from=builder /app/dist /usr/share/nginx/html #shell to be able to catch variables at docker run time #https://dev.to/sanjayttg/dynamic-environment-variables-for-dockerized-react-apps-5bc5 -# COPY env.sh /docker-entrypoint.d/env.sh -# RUN chmod +x /docker-entrypoint.d/env.sh +COPY env.sh /docker-entrypoint.d/env.sh +RUN chmod +x /docker-entrypoint.d/env.sh # Expose the port NGINX is running on