Initial version
This commit is contained in:
parent
47c6fc7568
commit
bae70b9884
@ -35,3 +35,4 @@
|
||||
/app/assets/builds/*
|
||||
!/app/assets/builds/.keep
|
||||
/public/assets
|
||||
.docker-compose.yml
|
42
Dockerfile.dev
Normal file
42
Dockerfile.dev
Normal file
@ -0,0 +1,42 @@
|
||||
# syntax = docker/dockerfile:1
|
||||
|
||||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
||||
ARG RUBY_VERSION=3.3.5
|
||||
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
|
||||
|
||||
# Rails app lives here
|
||||
WORKDIR /rails
|
||||
|
||||
RUN apt-get update && apt-get install -y nodejs
|
||||
|
||||
FROM base as build
|
||||
|
||||
# Install packages needed to build gems
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config
|
||||
|
||||
# Install application gems
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
# Final stage for app image
|
||||
FROM base
|
||||
|
||||
# Install packages needed for deployment
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install --no-install-recommends -y curl libvips postgresql-client && \
|
||||
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||
|
||||
# Copy built artifacts: gems, application
|
||||
COPY --from=build /usr/local/bundle /usr/local/bundle
|
||||
COPY --from=build /rails /rails
|
||||
|
||||
# Entrypoint prepares the database.
|
||||
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
||||
|
||||
# Start the server by default, this can be overwritten at runtime
|
||||
EXPOSE 3001
|
||||
CMD ["./bin/rails", "server", "--binding=0.0.0.0"]
|
38
docker-compose.yml
Normal file
38
docker-compose.yml
Normal file
@ -0,0 +1,38 @@
|
||||
services:
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.dev
|
||||
ports:
|
||||
- "3001:3001"
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
|
||||
RAILS_ENV: development
|
||||
PORT: 3001
|
||||
frontend:
|
||||
build: ../wedding-planner-frontend
|
||||
ports:
|
||||
- 3000:3000
|
||||
depends_on:
|
||||
- backend
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
depends_on:
|
||||
- frontend
|
||||
- backend
|
||||
db:
|
||||
image: postgres:17
|
||||
ports:
|
||||
- 5432
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
|
||||
|
@ -3,12 +3,12 @@ server {
|
||||
server_name libre-wedding-planner.app.localhost;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:3001/;
|
||||
proxy_pass http://backend:3001/;
|
||||
proxy_set_header Host $http_host;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3000;
|
||||
proxy_pass http://frontend:3000;
|
||||
proxy_set_header Host $http_host;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user