-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from RyosukeDTomita/feature/env-change
Feature/env change
- Loading branch information
Showing
32 changed files
with
262 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,47 @@ | ||
# Build Image | ||
FROM node:20 AS build | ||
WORKDIR /app | ||
|
||
# defaultをdevelopmentにし,引数でproductionにも切り替えられるようにする | ||
ARG BUILD_ENV=development | ||
|
||
COPY . . | ||
RUN npm install && npm run build | ||
|
||
# npm startは.env.developmentが優先されるがnpm run buildでは.env.productoinが優先されるので注意。 | ||
RUN <<EOF | ||
npm install | ||
if [ "$BUILD_ENV" = "development" ]; then | ||
echo "build mode = development" | ||
npm run build | ||
elif [ "$BUILD_ENV" = "staging" ]; then | ||
echo "build mode = staging" | ||
elif [ "$BUILD_ENV" = "productoin" ]; then | ||
echo "build mode = production" | ||
npm run build-dev | ||
else | ||
echo "build mode = unknown" | ||
exit 1 | ||
fi | ||
|
||
rm -rf node_modules/.cache | ||
EOF | ||
|
||
|
||
# Product Image | ||
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nginx:latest-al23 | ||
|
||
# Change owner to allow non-root users to start the service | ||
USER root | ||
RUN mkdir -p /var/log/nginx \ | ||
&& chown -R nginx:nginx /var/log/nginx \ | ||
&& touch /run/nginx.pid \ | ||
&& chown -R nginx:nginx /run/nginx.pid | ||
RUN <<EOF | ||
mkdir -p /var/log/nginx | ||
chown -R nginx:nginx /var/log/nginx | ||
touch /run/nginx.pid | ||
chown -R nginx:nginx /run/nginx.pid | ||
EOF | ||
|
||
COPY --from=build /app/build /usr/share/nginx/html | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Use 8080 instead of 80 to avoid the `nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)` when using ECS. | ||
EXPOSE 8080 | ||
USER nginx | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.