Skip to content

Instantly share code, notes, and snippets.

View Eventyret's full-sized avatar
🧑‍🚀
Seňor Full-Snack Developer

Simen Daehlin Eventyret

🧑‍🚀
Seňor Full-Snack Developer
View GitHub Profile
@Eventyret
Eventyret / docker-compose.liquid
Created July 18, 2024 09:20
docker-compose file used with strapi-dockerize-tool
version: '3'
services:
{{name}}:
container_name: {{name}}
build: .
image: {{name}}:latest
restart: unless-stopped
env_file: .env
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
@Eventyret
Eventyret / Dockerfile-prod.liquid
Created July 18, 2024 09:19
Dockerfile used with strapi-dockerize-tool
# Creating multi-stage build for production
FROM node:20-alpine as build
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev > /dev/null 2>&1
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
{%- if packageManager == "yarn" %}
COPY package.json yarn.lock ./
RUN yarn config set network-timeout 600000 -g && yarn install --production
@Eventyret
Eventyret / Dockerfile.liquid
Last active July 18, 2024 09:18
Dockerfile used with strapi-dockerize-tool
FROM {{ nodeVersion }}-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
{%- if packageManager == "yarn" %}
COPY package.json yarn.lock ./
RUN yarn config set network-timeout 600000 -g && yarn install
@Eventyret
Eventyret / setup.sh
Created October 8, 2023 07:48
Easy Panels Server Setup
#!/bin/bash
function update_packages() {
echo -e "\n📦 Updating packages... 📦\n"
apt-get update -y
apt-get upgrade -y
apt-get autoremove -y
apt-get autoclean -y
}
@Eventyret
Eventyret / transferdata.js
Created August 30, 2023 07:43
Transfer data from two API's
const fetch = require('node-fetch');
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const ghostEndpoint = 'https://ghostcms.com/content/posts/';
const strapiEndpoint = 'https://strapiinstance.com/api/blogs';
async function fetchData() {
try {
@Eventyret
Eventyret / setup.sh
Created August 22, 2023 20:47
Dokku Setup
#!/bin/bash
function update_packages() {
echo -e "\n📦 Updating packages... 📦\n"
apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y
apt-get autoremove -y
apt-get autoclean -y
}
@Eventyret
Eventyret / lifecycle.js
Created March 29, 2023 11:38
Validation Lifcylehook
const utils = require("@strapi/utils");
const { ApplicationError } = utils.errors;
const isDisconnecting = (disconnectArray, entityValue) => {
return disconnectArray.length && entityValue !== null;
};
module.exports = {
async beforeUpdate(event) {
const { data, where } = event.params;
version: '3.9'
services:
# Strapi Dev Enviroment
strapidev:
container_name: strapi_dev
build:
context: .
dockerfile: Dockerfile
args:
NODE_ENV: ${NODE_ENV}
@Eventyret
Eventyret / resources.md
Created February 12, 2019 10:37
Student Resources

Resources that are helpful