second commit with content but still need .env info
This commit is contained in:
parent
920f0b56a8
commit
efa90a9532
5 changed files with 67 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
*.kate-swp
|
*.kate-swp
|
||||||
|
.env
|
||||||
|
|
26
Dockerfile
26
Dockerfile
|
@ -0,0 +1,26 @@
|
||||||
|
# Use this image as the platform to build the app
|
||||||
|
FROM node:20.11-alpine AS external-website
|
||||||
|
|
||||||
|
# A small line inside the image to show who made it
|
||||||
|
LABEL Developers="Dave Lane, Lane Ventures"
|
||||||
|
|
||||||
|
# The WORKDIR instruction sets the working directory for everything that will happen next
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy all local files into the image
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Clean install all node modules
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Build SvelteKit app
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Delete source code files that were used to build the app that are no longer needed
|
||||||
|
RUN rm -rf src/ static/ emailTemplates/ docker-compose.yml
|
||||||
|
|
||||||
|
# The USER instruction sets the user name to use as the default user for the remainder of the current stage
|
||||||
|
USER node:node
|
||||||
|
|
||||||
|
# This is the command that will be run inside the image when you tell Docker to start the container
|
||||||
|
CMD ["node","build/index.js"]
|
16
README.md
16
README.md
|
@ -1,3 +1,17 @@
|
||||||
# sveltekit-docker-deployment
|
# sveltekit-docker-deployment
|
||||||
|
|
||||||
A recipe for deploying a SvelteKit app via Docker Compose.
|
A recipe for deploying a SvelteKit app via Docker Compose.
|
||||||
|
|
||||||
|
This project owes a lot to [this reference](https://medium.com/@loic.joachim/dockerize-sveltekit-with-node-adapter-62c5dc6fc15a).
|
||||||
|
|
||||||
|
## To build a new image
|
||||||
|
|
||||||
|
docker-compose build
|
||||||
|
|
||||||
|
## To start it up (and tail the logs - CTRL-C to quit out of the logs without affecting running container)
|
||||||
|
|
||||||
|
docker-compose up -d && docker-compose logs -f
|
||||||
|
|
||||||
|
## To clear out an old image (if it's running)
|
||||||
|
|
||||||
|
docker-compose down --remove-orphans --rmi 'all'
|
||||||
|
|
24
docker-compose.yml
Normal file
24
docker-compose.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# docker-compose.yml
|
||||||
|
|
||||||
|
services:
|
||||||
|
external:
|
||||||
|
container_name: external
|
||||||
|
# The name of the image that will be created when building this container
|
||||||
|
# Change this based on your app's name...
|
||||||
|
image: external-website:latest
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
user: "node"
|
||||||
|
environment:
|
||||||
|
# Internal server error messages will not send stacktrace to the browser in production
|
||||||
|
- NODE_ENV=production
|
||||||
|
# Sets the timezone of the containers OS
|
||||||
|
- TZ=Pacific/Auckland
|
||||||
|
# Points to a file with the sensitive environment variables
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
# change the port on 127.0.0.1 to ensure it's not already in use on the host.
|
||||||
|
- 127.0.0.1:5050:5050
|
1
env.sample
Normal file
1
env.sample
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# copy this to .env to enable...
|
Loading…
Reference in a new issue