Skip to content

Commit

Permalink
feat: docker compose + Dockerfile using alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinszuchet committed Jan 8, 2025
1 parent 9453b4e commit 12e5c2c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

FROM node:18-bullseye-slim as builderenv
FROM node:18-alpine AS builderenv

WORKDIR /app

# some packages require a build step
RUN apt-get update && apt-get install -y --no-install-recommends wget build-essential && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apk update && apk add --no-cache wget

# build the app
COPY . /app
Expand All @@ -16,12 +16,17 @@ RUN yarn install --prod --frozen-lockfile

########################## END OF BUILD STAGE ##########################

FROM node:18-bullseye-slim
FROM node:18-alpine

RUN apt-get update && apt-get install -y --no-install-recommends tini && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apk update && apk add --no-cache wget tini curl gcompat libstdc++ && \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-2.35-r1.apk && \
apk add --no-cache ./glibc-2.35-r1.apk && \
rm -f ./glibc-2.35-r1.apk && \
rm -rf /var/cache/apk/*

# NODE_ENV is used to configure some runtime options, like JSON logger
ENV NODE_ENV production
ENV NODE_ENV=production

ARG COMMIT_HASH=local
ENV COMMIT_HASH=${COMMIT_HASH:-local}
Expand Down
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
services:
postgres:
image: postgres:latest
container_name: postgres-local
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: social_service_ea
ports:
- '5432:5432'
volumes:
- postgres-data:/var/lib/postgresql/data

redis:
image: redis:latest
container_name: redis-local
ports:
- '6379:6379'

app:
image: social-service-ea:local
build:
context: .
dockerfile: Dockerfile
environment:
PG_COMPONENT_PSQL_CONNECTION_STRING: 'postgresql://postgres:postgres@postgres:5432/social_service_ea'
REDIS_HOST: 'redis'
ports:
- '3000:3000'
depends_on:
- postgres
- redis

volumes:
postgres-data:

0 comments on commit 12e5c2c

Please sign in to comment.