Accelerate development with project starters
Ready-to-use project starters are available for frameworks such as Symfony, Nuxt, and Express, allowing developers to begin coding immediately without manual initial configuration.
website·Indexed 29 days ago
http://toolbox.matteo-bonneval.frA collection of templates for Docker images and GitLab CI/CD pipelines. Includes production-ready Dockerfiles for Nuxt, Vue.js, React, Express, NestJS, Flask, and FastAPI, as well as GitLab pipeline templates for automated building, testing, and deployment, and Caddy reverse proxy installation guides.
docker swarm initdocker run -d \
-p 1025:1025 \
-p 8025:8025 \
--name mailhog \
mailhog/mailhogbuild) uses node:20-alpine to install dependencies and build the project. The second stage (production) uses nginx:stable-alpine to serve the static files from the /app/build directory, exposing port 80.FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Production Stage
FROM nginx:stable-alpine AS production
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]openssl and musl) and sets up the working directory and dependency installation before copying the application source code.FROM node:20-alpine
# Add necessary dependencies
RUN apk add --no-cache openssl musl
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
# Replace server.js with the name of your main entry file
CMD ["node", "server.js"].output directory to minimize image size.ARG NODE_VERSION=20.18.0
FROM node:${NODE_VERSION}-slim as base
ARG PORT=3000
WORKDIR /src
# Build
FROM base as build
COPY --link package.json package-lock.json .
RUN npm install
COPY --link .. .
RUN npm run build
# Run
FROM base
ENV PORT=$PORT
ENV NODE_ENV=production
COPY --from=build /src/.output /src/.output
CMD [ "node", ".output/server/index.mjs" ]uvicorn to be installed and a requirements.txt file to be present in the root directory. The container exposes port 80 and starts the application using Uvicorn, targeting the app.main:app entry point.FROM python:3.12
WORKDIR /app
COPY . /app
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 80
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]Before running the pipeline, perform the following manual setup on the server:
compose.yaml file defining your services.docker service ls to use it in the deployment script.# Authenticate with GitLab Registry
docker login -u [user_gitlab] -p [password_gitlab] registry.gitlab.com
# Pre-pull image
docker pull registry.gitlab.com/[username]/[image]:latest
# Initial stack deployment
docker stack deploy -c compose.yaml [STACK_NAME]
# Verify service name
docker service lsdeploy stage to your .gitlab-ci.yml file. The pipeline uses an Alpine image to install an SSH client, decodes the base64 private key, and executes the deploy.sh script on the remote server. This job is configured to run only on the main branch.stages:
- build
- deploy
variables:
PATH_DEPLOY: [PATH_TO_DEPLOY_SH_FOLDER]
deploy:
stage: deploy
image: alpine:latest
only:
- main
script:
- apk add --no-cache openssh-client
- mkdir -p ~/.ssh
- echo ${SSH_PRIVATE_KEY} | base64 -d > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keygen -l -f ~/.ssh/id_rsa
- ssh -o StrictHostKeyChecking=no ${USER_SERVE}@${IP_SERVE} "cd ${PATH_DEPLOY}/ && ./deploy.sh"sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy