Skip to content
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

feat: Multi-stage build Dockerfile for building and serving threat composer. Close #97 #128

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Changes from all 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
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM public.ecr.aws/p9i6h6j0/aws-pdk:latest as build

#install dependencies
RUN dnf -y install rsync

# Create a non-root user named 'app' and set up home directory
RUN useradd -m app

# Create an app directory and change its ownership to the 'app' user
RUN mkdir /app && chown app:app /app

# Switch to the 'app' user
USER app

# Set the working directory to the app directory
WORKDIR /app

#Copy files into the Docker image
COPY --chown=app:app . .
RUN ./scripts/build.sh

# Stage 2: Serve the application using Nginx
FROM nginx:alpine
# Remove the default nginx website
RUN rm -rf /usr/share/nginx/html/*
# Copy the build output to the nginx html directory
COPY --from=build /app/packages/threat-composer-app/build/website/ /usr/share/nginx/html
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]
Loading