Dockerfiles used to deploy Astro and PocketBase on Railway
New Course Coming Soon:
Get Really Good at Git
Here’s a super quick way to deploy Astro and PocketBase on Railway (referral link).
I used this Dockerfile to deploy PocketBase:
FROM ubuntu:latest
ARG PB_VERSION=0.20.4
# Install unzip and ca-certificates
RUN apt-get update && \
apt-get install -y \
unzip \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
# download and unzip PocketBase
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
RUN unzip /tmp/pb.zip -d /pb/ && \
rm /tmp/pb.zip
EXPOSE 8080
# start PocketBase
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]
and this Dockerfile to deploy SSR Astro:
FROM node:lts-slim as runtime
WORKDIR /app
# Ensure that both node_modules and package-lock.json are removed.
COPY package.json .
RUN rm -rf node_modules package-lock.json
# Perform a fresh installation of npm dependencies.
RUN npm install
# Copy the rest of your application files.
COPY . .
# Build your application.
RUN npm run build
# Set environment variables and expose the appropriate port.
ENV HOST=0.0.0.0
ENV PORT=3000
EXPOSE 3000
# Define the command to run your application.
CMD node ./dist/server/entry.mjs
Avoiding Alpine Linux as the base image fixed an issue with internal links I had, so now the 2 instances can talk via *.railway.internal
internal Railway URLs.
Are you intimidated by Git? Can’t figure out merge vs
rebase? Are you afraid of screwing up something any time
you have to do something in Git? Do you rely on ChatGPT
or random people’s answer on StackOverflow to fix your
problems? Your coworkers are tired of explaining Git to
you all the time? Git is something we all need to use,
but few of us really master it. I created this course to
improve your Git (and GitHub) knowledge at a radical
level. A course that helps you feel less frustrated with
Git. Launching Summer 2024. Join the waiting list!
Here is how can I help you:
- COURSES where I teach everything I know
- THE VALLEY OF CODE your web development manual
- BOOTCAMP 2024 cohort in progress, next edition in 2025
- BOOKS 16 coding ebooks you can download for free on JS Python C PHP and lots more
- SOLO LAB everything I know about running a lifestyle business as a solopreneur
- Interesting links collection
- Follow me on X