🚚(docker) move frontend docker config
Move frontend docker config to src/frontend/Dockerfile.
This commit is contained in:
@@ -31,3 +31,6 @@ db.sqlite3
|
|||||||
.mypy_cache
|
.mypy_cache
|
||||||
.pylint.d
|
.pylint.d
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
node_modules
|
||||||
|
|||||||
4
.github/workflows/docker-hub.yml
vendored
4
.github/workflows/docker-hub.yml
vendored
@@ -75,6 +75,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
file: ./src/frontend/Dockerfile
|
||||||
target: frontend-production
|
target: frontend-production
|
||||||
build-args: DOCKER_USER=${{ env.DOCKER_USER }}:-1000
|
build-args: DOCKER_USER=${{ env.DOCKER_USER }}:-1000
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
@@ -107,7 +108,8 @@ jobs:
|
|||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: ./src/frontend/
|
context: .
|
||||||
|
file: ./src/frontend/Dockerfile
|
||||||
target: y-webrtc-signaling
|
target: y-webrtc-signaling
|
||||||
build-args: DOCKER_USER=${{ env.DOCKER_USER }}:-1000
|
build-args: DOCKER_USER=${{ env.DOCKER_USER }}:-1000
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|||||||
49
Dockerfile
49
Dockerfile
@@ -11,55 +11,6 @@ RUN apt-get update && \
|
|||||||
apt-get -y upgrade && \
|
apt-get -y upgrade && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
### ---- Front-end dependencies image ----
|
|
||||||
FROM node:20 as frontend-deps
|
|
||||||
|
|
||||||
WORKDIR /deps
|
|
||||||
|
|
||||||
COPY ./src/frontend/package.json ./package.json
|
|
||||||
COPY ./src/frontend/yarn.lock ./yarn.lock
|
|
||||||
COPY ./src/frontend/apps/impress/package.json ./apps/impress/package.json
|
|
||||||
COPY ./src/frontend/packages/i18n/package.json ./packages/i18n/package.json
|
|
||||||
COPY ./src/frontend/packages/eslint-config-impress/package.json ./packages/eslint-config-impress/package.json
|
|
||||||
|
|
||||||
RUN yarn --frozen-lockfile
|
|
||||||
|
|
||||||
### ---- Front-end builder image ----
|
|
||||||
FROM node:20 as frontend-builder-1
|
|
||||||
|
|
||||||
WORKDIR /builder
|
|
||||||
|
|
||||||
COPY --from=frontend-deps /deps/node_modules ./node_modules
|
|
||||||
COPY ./src/frontend .
|
|
||||||
|
|
||||||
WORKDIR /builder/apps/impress
|
|
||||||
|
|
||||||
FROM frontend-builder-1 as frontend-builder-2
|
|
||||||
|
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
|
|
||||||
# ---- Front-end image ----
|
|
||||||
FROM nginxinc/nginx-unprivileged:1.25 as frontend-production
|
|
||||||
|
|
||||||
# Un-privileged user running the application
|
|
||||||
ARG DOCKER_USER
|
|
||||||
USER ${DOCKER_USER}
|
|
||||||
|
|
||||||
COPY --from=frontend-builder-2 \
|
|
||||||
/builder/apps/impress/out \
|
|
||||||
/usr/share/nginx/html
|
|
||||||
|
|
||||||
COPY ./src/frontend/apps/impress/conf/default.conf /etc/nginx/conf.d
|
|
||||||
|
|
||||||
# Copy entrypoint
|
|
||||||
COPY ./docker/files/usr/local/bin/entrypoint /usr/local/bin/entrypoint
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
|
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
|
|
||||||
|
|
||||||
# ---- Back-end builder image ----
|
# ---- Back-end builder image ----
|
||||||
FROM base as back-builder
|
FROM base as back-builder
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,11 @@ docker_build(
|
|||||||
docker_build(
|
docker_build(
|
||||||
'localhost:5001/impress-frontend:latest',
|
'localhost:5001/impress-frontend:latest',
|
||||||
context='..',
|
context='..',
|
||||||
dockerfile='../Dockerfile',
|
dockerfile='../src/frontend/Dockerfile',
|
||||||
build_args={'ENV': 'dev'},
|
only=['./src/frontend', './docker', './dockerignore'],
|
||||||
only=['./src/frontend', './src/mail', './docker'],
|
target = 'impress',
|
||||||
target = 'frontend-builder-1',
|
|
||||||
live_update=[
|
live_update=[
|
||||||
sync('../src/frontend', '/builder'),
|
sync('../src/frontend', '/home/frontend'),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,9 @@ services:
|
|||||||
|
|
||||||
y-webrtc-signaling:
|
y-webrtc-signaling:
|
||||||
build:
|
build:
|
||||||
context: ./src/frontend/
|
context: .
|
||||||
|
dockerfile: ./src/frontend/Dockerfile
|
||||||
|
target: y-webrtc-signaling
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "4444:4444"
|
- "4444:4444"
|
||||||
|
|||||||
@@ -1,17 +1,62 @@
|
|||||||
FROM node:20-alpine as y-webrtc-signaling
|
FROM node:20 as frontend-deps
|
||||||
|
|
||||||
WORKDIR /home/frontend/
|
WORKDIR /home/frontend/
|
||||||
|
|
||||||
COPY ./package.json .
|
COPY ./src/frontend/package.json ./package.json
|
||||||
COPY ./apps/y-webrtc-signaling/package.json ./apps/y-webrtc-signaling/
|
COPY ./src/frontend/yarn.lock ./yarn.lock
|
||||||
COPY ./packages/eslint-config-impress/package.json ./packages/eslint-config-impress/
|
COPY ./src/frontend/apps/impress/package.json ./apps/impress/package.json
|
||||||
|
COPY ./src/frontend/apps/y-webrtc-signaling/package.json ./apps/y-webrtc-signaling/package.json
|
||||||
|
COPY ./src/frontend/packages/i18n/package.json ./packages/i18n/package.json
|
||||||
|
COPY ./src/frontend/packages/eslint-config-impress/package.json ./packages/eslint-config-impress/package.json
|
||||||
|
|
||||||
RUN yarn install
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
COPY . .
|
COPY ./src/frontend/ .
|
||||||
|
|
||||||
|
# Copy entrypoint
|
||||||
|
COPY ./docker/files/usr/local/bin/entrypoint /usr/local/bin/entrypoint
|
||||||
|
|
||||||
|
# ---- y-webrtc-signaling ----
|
||||||
|
FROM frontend-deps as y-webrtc-signaling
|
||||||
|
|
||||||
WORKDIR /home/frontend/apps/y-webrtc-signaling
|
WORKDIR /home/frontend/apps/y-webrtc-signaling
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
# Un-privileged user running the application
|
||||||
|
ARG DOCKER_USER
|
||||||
|
USER ${DOCKER_USER}
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
|
||||||
|
|
||||||
|
CMD ["yarn", "start"]
|
||||||
|
|
||||||
|
### ---- Front-end builder image ----
|
||||||
|
FROM frontend-deps as impress
|
||||||
|
|
||||||
|
WORKDIR /home/frontend/apps/impress
|
||||||
|
|
||||||
|
# Tilt will rebuild impress target so, we dissociate impress and impress-builder
|
||||||
|
# to avoid rebuilding the app at every changes.
|
||||||
|
FROM impress as impress-builder
|
||||||
|
|
||||||
|
WORKDIR /home/frontend/apps/impress
|
||||||
|
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
CMD ["yarn", "start"]
|
# ---- Front-end image ----
|
||||||
|
FROM nginxinc/nginx-unprivileged:1.25 as frontend-production
|
||||||
|
|
||||||
|
# Un-privileged user running the application
|
||||||
|
ARG DOCKER_USER
|
||||||
|
USER ${DOCKER_USER}
|
||||||
|
|
||||||
|
COPY --from=impress-builder \
|
||||||
|
/home/frontend/apps/impress/out \
|
||||||
|
/usr/share/nginx/html
|
||||||
|
|
||||||
|
COPY ./src/frontend/apps/impress/conf/default.conf /etc/nginx/conf.d
|
||||||
|
COPY ./docker/files/usr/local/bin/entrypoint /usr/local/bin/entrypoint
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user