Added a bunch of Docker crap but I think Dockerfile.build is all that matters
This commit is contained in:
parent
3f33d5fda4
commit
5f3b592724
|
@ -0,0 +1,3 @@
|
|||
node_modules
|
||||
.git
|
||||
*.log
|
5
.env
5
.env
|
@ -1,5 +1,2 @@
|
|||
# URL of the API
|
||||
REACT_APP_API_URL=http://localhost:8080
|
||||
REACT_APP_API_URL=http://zbox.local:8080
|
||||
|
||||
# Base URL of the webapp
|
||||
REACT_APP_BASE_URL="/"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
FROM node:18-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY .env .
|
||||
COPY . .
|
||||
CMD ["npm", "run", "build"]
|
|
@ -0,0 +1,23 @@
|
|||
# Stage 1: Install dependencies
|
||||
FROM node:14 AS build-stage
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json first to leverage caching
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of your application code
|
||||
COPY .env .
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Final stage: nothing needed, just to complete the multi-stage
|
||||
FROM scratch
|
||||
|
||||
# Copy the build output from the previous stage to a directory
|
||||
COPY --from=build-stage /app/build ./build
|
|
@ -0,0 +1,20 @@
|
|||
# Dockerfile.create
|
||||
FROM node:14 AS builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
RUN npm install -g serve
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
COPY .env .
|
||||
|
||||
RUN npm build .
|
||||
|
||||
CMD ["serve", "-s", "build"]
|
|
@ -0,0 +1,4 @@
|
|||
FROM nginx:alpine
|
||||
COPY build /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -0,0 +1,18 @@
|
|||
# Dockerfile.update
|
||||
FROM node:14
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
ENV REACT_APP_API_URL=http://zbox.local:8080
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
COPY .env .
|
||||
|
||||
CMD ["npm", "run", "build"]
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Create teh react-builder image
|
||||
docker build -f Dockerfile.create -t react-builder:latest .
|
||||
# Run the react-builder image with local build/ dir mounted
|
||||
docker run -v $(pwd)/build:/app/build react-builder:latest
|
||||
# create the nginx container:
|
||||
docker build --no-cache -f Dockerfile.nginx -t boxes-fe:latest .
|
|
@ -1,29 +0,0 @@
|
|||
# Use an official Node runtime as the base image
|
||||
FROM node:14 as build
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
|
||||
# Build the app
|
||||
RUN npm run build
|
||||
|
||||
# Use nginx to serve the static files
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy the build output to replace the default nginx contents
|
||||
COPY --from=build /app/build /usr/share/nginx/html
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set the username and password
|
||||
USERNAME="boxuser"
|
||||
PASSWORD="boxuser"
|
||||
EMAIL="boxuser@r8z.us"
|
||||
|
||||
# Set the database file and table name
|
||||
DB_FILE="../boxes-api/data/boxes.db"
|
||||
TABLE_NAME="users"
|
||||
|
||||
# Generate the bcrypt encrypted password using htpasswd
|
||||
ENCRYPTED_PASSWORD=$(htpasswd -bnBC 10 "" "$PASSWORD" | tr -d ':\n')
|
||||
|
||||
# Insert the username and encrypted password into the database
|
||||
sqlite3 "$DB_FILE" "INSERT INTO $TABLE_NAME (username, password, email) VALUES ('$USERNAME', '$ENCRYPTED_PASSWORD', '$EMAIL')"
|
||||
|
||||
echo "Password encrypted and stored in the database."
|
Loading…
Reference in New Issue