Skip to content

Commit

Permalink
Improve dockerfile build process and bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-emilius committed Dec 1, 2024
1 parent 4749fa8 commit 923cc57
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 155 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
fail-fast: false
matrix:
include:
- dockerfile: ./client/Dockerfile
- dockerfile: ./client.Dockerfile
image: ghcr.io/ls1intum/thesis-track/thesis-track-client
context: ./client
context: ./
path: client
- dockerfile: ./server/Dockerfile
- dockerfile: ./server.Dockerfile
image: ghcr.io/ls1intum/thesis-track/thesis-track-server
context: ./server
context: ./
path: server
outputs:
server_image_tag: "${{ steps.output-tag-server.outputs.server_image_tag }}"
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/deploy_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ jobs:
script: |
docker compose -f docker-compose.prod.yml --env-file=.env.prod down --remove-orphans --rmi all
- name: Checkout Code
uses: actions/checkout@v4

- name: Get Git Commit Hash
id: git_info
run: echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Get Branch Name
id: branch_name
run: echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV

- name: Create main.cf and master.cf File
run: |
echo "${{ vars.POSTFIX_MAIN_CF }}" > main.cf
Expand Down Expand Up @@ -146,9 +135,6 @@ jobs:
echo "SERVER_IMAGE_TAG=${{ inputs.server_image_tag }}" >> .env.prod
echo "CLIENT_IMAGE_TAG=${{ inputs.client_image_tag }}" >> .env.prod
echo "GIT_COMMIT=${{ env.GIT_COMMIT }}" >> .env.prod
echo "GIT_BRANCH=${{ env.GIT_BRANCH }}" >> .env.prod
- name: SSH to VM and Execute Docker-Compose Up
uses: appleboy/[email protected]
Expand Down
12 changes: 4 additions & 8 deletions client/Dockerfile → client.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ FROM node:22-alpine as build

WORKDIR /app

COPY package.json ./
COPY package-lock.json ./

RUN npm install
COPY . .

WORKDIR /app/client
ENV CI 1

COPY . ./

RUN npm install
RUN npm run build

FROM nginx:stable-alpine

COPY --from=build /app/build /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/client/build /usr/share/nginx/html
COPY ./client/nginx/nginx.conf /etc/nginx/conf.d/default.conf

# use same node version like in the build image
COPY --from=build /usr/lib /usr/lib
Expand Down
Loading

0 comments on commit 923cc57

Please sign in to comment.